Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Really fix #1917
  • Loading branch information
ralsina committed Jul 30, 2015
1 parent 292a04a commit 3d81974
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nikola/plugins/command/import_wordpress.py
Expand Up @@ -509,13 +509,17 @@ def import_attachment(self, item, wordpress_namespace):
image_meta = metadata[meta_key]
dst_meta = {}

def add(our_key, wp_key, is_int=False, ignore_zero=False):
def add(our_key, wp_key, is_int=False, ignore_zero=False, is_float=False):
if wp_key in image_meta:
value = image_meta[wp_key]
if is_int:
value = int(value)
if ignore_zero and value == 0:
return
elif is_float:
value = float(value)
if ignore_zero and value == 0:
return
else:
value = value.decode('utf-8') # assume UTF-8
if value == '': # skip empty values
Expand All @@ -530,7 +534,7 @@ def add(our_key, wp_key, is_int=False, ignore_zero=False):
add('copyright', b'copyright')
add('focal_length', b'focal_length', is_int=True, ignore_zero=True)
add('iso', b'iso', is_int=True, ignore_zero=True)
add('shutter_speed', b'shutter_speed', is_int=False, ignore_zero=True)
add('shutter_speed', b'shutter_speed', is_int=False, ignore_zero=True, is_float=True)
add('title', b'title')

if len(dst_meta) > 0:
Expand Down

0 comments on commit 3d81974

Please sign in to comment.