mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Attempt to be compilant with Python 3.
This commit is contained in:
parent
7d43c4fa00
commit
6fb0335269
1 changed files with 7 additions and 3 deletions
|
|
@ -5,12 +5,16 @@ import six
|
||||||
import copy
|
import copy
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
import urlparse
|
|
||||||
import functools
|
import functools
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urlparse import urlparse, urlunparse
|
||||||
|
except ImportError:
|
||||||
|
from urllib.parse import urlparse, urlunparse
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -195,7 +199,7 @@ class Content(object):
|
||||||
|
|
||||||
def replacer(m):
|
def replacer(m):
|
||||||
what = m.group('what')
|
what = m.group('what')
|
||||||
value = urlparse.urlparse(m.group('value'))
|
value = urlparse(m.group('value'))
|
||||||
path = value.path
|
path = value.path
|
||||||
origin = m.group('path')
|
origin = m.group('path')
|
||||||
|
|
||||||
|
|
@ -224,7 +228,7 @@ class Content(object):
|
||||||
# keep all other parts, such as query, fragment, etc.
|
# keep all other parts, such as query, fragment, etc.
|
||||||
parts = list(value)
|
parts = list(value)
|
||||||
parts[2] = origin
|
parts[2] = origin
|
||||||
origin = urlparse.urlunparse(parts)
|
origin = urlunparse(parts)
|
||||||
|
|
||||||
return ''.join((m.group('markup'), m.group('quote'), origin,
|
return ''.join((m.group('markup'), m.group('quote'), origin,
|
||||||
m.group('quote')))
|
m.group('quote')))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue