aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools/exif.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2014-07-14 05:49:38 +0300
committerBerker Peksag <berker.peksag@gmail.com>2014-07-14 05:49:38 +0300
commit9459fa3cede5b1a1a061cc5a15a25b2715d0d47d (patch)
treead6ec8bc18dbf4a75c58ee0492b81e4077e38213 /mediagoblin/tools/exif.py
parent19baab1b034b31a53a0dbddd17d3f31594ce5afc (diff)
downloadmediagoblin-9459fa3cede5b1a1a061cc5a15a25b2715d0d47d.tar.lz
mediagoblin-9459fa3cede5b1a1a061cc5a15a25b2715d0d47d.tar.xz
mediagoblin-9459fa3cede5b1a1a061cc5a15a25b2715d0d47d.zip
Fix tests on Python 3.
Diffstat (limited to 'mediagoblin/tools/exif.py')
-rw-r--r--mediagoblin/tools/exif.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mediagoblin/tools/exif.py b/mediagoblin/tools/exif.py
index 5de9a772..ec83f43c 100644
--- a/mediagoblin/tools/exif.py
+++ b/mediagoblin/tools/exif.py
@@ -112,7 +112,7 @@ def _ifd_tag_to_dict(tag):
'field_length': tag.field_length,
'values': None}
- if isinstance(tag.printable, str):
+ if isinstance(tag.printable, six.binary_type):
# Force it to be decoded as UTF-8 so that it'll fit into the DB
data['printable'] = tag.printable.decode('utf8', 'replace')
@@ -120,7 +120,7 @@ def _ifd_tag_to_dict(tag):
data['values'] = [_ratio_to_list(val) if isinstance(val, Ratio) else val
for val in tag.values]
else:
- if isinstance(tag.values, str):
+ if isinstance(tag.values, six.binary_type):
# Force UTF-8, so that it fits into the DB
data['values'] = tag.values.decode('utf8', 'replace')
else:
@@ -134,7 +134,8 @@ def _ratio_to_list(ratio):
def get_useful(tags):
- return dict((key, tag) for (key, tag) in six.iteritems(tags))
+ from collections import OrderedDict
+ return OrderedDict((key, tag) for (key, tag) in six.iteritems(tags))
def get_gps_data(tags):