aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-11-30 20:46:26 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-11-30 20:46:26 +0100
commitaed5a5ebc8fa63834c2a29e1614debf4e92c04ac (patch)
tree06e102dd76edc8e095c0c4addb7d6eb815ea6135 /src
parent6ef2b5a626270fa7dae1099fc3617a34112af149 (diff)
downloadpyexiv2-aed5a5ebc8fa63834c2a29e1614debf4e92c04ac.tar.gz
Accept Fraction objects for Rational and SRational values in EXIF tags.
Diffstat (limited to 'src')
-rw-r--r--src/pyexiv2/exif.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pyexiv2/exif.py b/src/pyexiv2/exif.py
index 0acb775..a3b83b1 100644
--- a/src/pyexiv2/exif.py
+++ b/src/pyexiv2/exif.py
@@ -30,7 +30,8 @@ EXIF specific code.
import libexiv2python
-from pyexiv2.utils import Rational, NotifyingList, ListenerInterface, \
+from pyexiv2.utils import Rational, Fraction, \
+ NotifyingList, ListenerInterface, \
undefined_to_string, string_to_undefined
import time
@@ -376,13 +377,13 @@ class ExifTag(ListenerInterface):
raise ExifValueError(value, self.type)
elif self.type == 'Rational':
- if type(value) is Rational and value.numerator >= 0:
+ if type(value) in (Rational, Fraction) and value.numerator >= 0:
return str(value)
else:
raise ExifValueError(value, self.type)
elif self.type == 'SRational':
- if type(value) is Rational:
+ if type(value) in (Rational, Fraction):
return str(value)
else:
raise ExifValueError(value, self.type)