Skip to content
Permalink
Browse files
Change suggested by Kwpolska.
  • Loading branch information
felixfontein committed Jun 30, 2015
1 parent 044732e commit c926116332a94208699fa4fab02ce7d4219a9bcb
Showing with 7 additions and 8 deletions.
  1. +7 −8 nikola/plugins/command/import_wordpress.py
@@ -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)
@@ -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('/')):

0 comments on commit c926116

Please sign in to comment.