Skip to content

Commit

Permalink
Fixed Python 3 problem caused by calling decode() on str object.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jun 29, 2015
1 parent 5781644 commit 7a17f12
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nikola/plugins/command/import_wordpress.py
Expand Up @@ -169,7 +169,11 @@ def show_info_about_mising_module(modulename):

# Add tag redirects
for tag in self.all_tags:
tag = utils.slugify(tag.decode('utf8'))
# 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
tag = utils.slugify(tag_str)
src_url = '{}tag/{}'.format(self.context['SITE_URL'], tag)
dst_url = self.site.link('tag', tag)
if src_url != dst_url:
Expand Down

0 comments on commit 7a17f12

Please sign in to comment.