aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-11-30 20:45:40 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-11-30 20:45:40 +0100
commit6ef2b5a626270fa7dae1099fc3617a34112af149 (patch)
tree1bbdf357a83925634803763ae108917362d1afe1
parent17c9ce29dd1b25537b9570191276e13cc3baa690 (diff)
downloadpyexiv2-6ef2b5a626270fa7dae1099fc3617a34112af149.tar.gz
Conditional import of fractions.Fraction for partial support if present.
-rw-r--r--src/pyexiv2/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pyexiv2/utils.py b/src/pyexiv2/utils.py
index 64138d2..5b0a3d5 100644
--- a/src/pyexiv2/utils.py
+++ b/src/pyexiv2/utils.py
@@ -31,6 +31,16 @@ Utilitary classes and functions.
import datetime
import re
+# Support for fractions.Fraction as a replacement for the Rational class is not
+# implemented yet as we have to support versions of Python < 2.6
+# (see https://launchpad.net/bugs/514415).
+# However, it doesn’t hurt to accept Fraction objects as values when the module
+# is available (see https://launchpad.net/bugs/683232).
+try:
+ from fractions import Fraction
+except ImportError:
+ Fraction = None
+
class FixedOffset(datetime.tzinfo):