Skip to content

Commit

Permalink
Change suggested by Kwpolska.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jun 30, 2015
1 parent 044732e commit c926116
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions nikola/plugins/command/import_wordpress.py
Expand Up @@ -184,10 +184,10 @@ def show_info_about_mising_module(modulename):

# Add tag redirects
for tag in self.all_tags:
# In python 2, path is a str. slug requires a unicode
# object. According to wikipedia, unquoted strings will
# usually be UTF8
tag_str = tag.decode('utf8') if isinstance(tag, utils.bytes_str) else tag
try:
tag_str = tag.decode('utf8')
except AttributeError:
tag_str = tag
tag = utils.slugify(tag_str)
src_url = '{}tag/{}'.format(self.context['SITE_URL'], tag)
dst_url = self.site.link('tag', tag)
Expand Down Expand Up @@ -420,11 +420,10 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
parsed = urlparse(link)
path = unquote(parsed.path.strip('/'))

# In python 2, path is a str. slug requires a unicode
# object. According to wikipedia, unquoted strings will
# usually be UTF8
if isinstance(path, utils.bytes_str):
try:
path = path.decode('utf8')
except AttributeError:
pass

# Cut out the base directory.
if path.startswith(self.base_dir.strip('/')):
Expand Down

0 comments on commit c926116

Please sign in to comment.