use list expression instead of 3-deep for
authorAndrás Veres-Szentkirályi <vsza@vsza.hu>
Thu, 21 Feb 2013 10:31:08 +0000 (11:31 +0100)
committerJoar Wandborg <joar@wandborg.se>
Fri, 22 Feb 2013 21:24:29 +0000 (22:24 +0100)
mediagoblin/tools/exif.py

index ac11169454035172e91e9abfe39672c7870a866b..2c0a11437995eec92971a27d2107d1ffcccb60d6 100644 (file)
@@ -114,13 +114,8 @@ def _ifd_tag_to_dict(tag):
         data['printable'] = tag.printable.decode('utf8', 'replace')
 
     if type(tag.values) == list:
-        data['values'] = []
-        for val in tag.values:
-            if isinstance(val, Ratio):
-                data['values'].append(
-                    _ratio_to_list(val))
-            else:
-                data['values'].append(val)
+        data['values'] = [_ratio_to_list(val) if isinstance(val, Ratio) else val
+                for val in tag.values]
     else:
         if isinstance(tag.values, str):
             # Force UTF-8, so that it fits into the DB