Skip to content
Permalink
Browse files

Really fix #1917

  • Loading branch information
ralsina committed Jul 30, 2015
1 parent 292a04a commit 3d819747c222ab3201f40e4be22338e7df7a222c
Showing with 6 additions and 2 deletions.
  1. +6 −2 nikola/plugins/command/import_wordpress.py
@@ -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
@@ -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:

0 comments on commit 3d81974

Please sign in to comment.
You can’t perform that action at this time.