Skip to content

Commit

Permalink
attempt to fix import_wordpress
Browse files Browse the repository at this point in the history
Signed-off-by: Chris “Kwpolska” Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jun 15, 2014
1 parent 2a6fd5d commit 1cf0a3e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nikola/plugins/command/import_wordpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,15 @@ def download_additional_image_sizes(self, item, wordpress_namespace, source_path
# your blogging into another site or system its not.
# Why don't they just use JSON?
if sys.version_info[0] == 2:
metadata = phpserialize.loads(utils.sys_encode(meta_value.text))
size_key = 'sizes'
file_key = 'file'
try:
metadata = phpserialize.loads(utils.sys_encode(meta_value.text))
except ValueError:
# local encoding might be wrong sometimes
metadata = phpserialize.loads(meta_value.text.encode('utf-8'))
else:
metadata = phpserialize.loads(meta_value.text.encode('UTF-8'))
size_key = b'sizes'
file_key = b'file'
metadata = phpserialize.loads(meta_value.text.encode('utf-8'))
size_key = b'sizes'
file_key = b'file'

if size_key not in metadata:
continue
Expand Down

0 comments on commit 1cf0a3e

Please sign in to comment.