1.1 --- a/DateSupport.py Tue Jul 16 17:09:48 2013 +0200
1.2 +++ b/DateSupport.py Tue Jul 23 00:17:58 2013 +0200
1.3 @@ -632,7 +632,7 @@
1.4 """
1.5
1.6 olson = self.olson_identifier()
1.7 - if olson and pytz:
1.8 + if olson:
1.9 tz = pytz.timezone(olson)
1.10 data = self.padded().as_tuple()[:6]
1.11 dt = datetime.datetime(*data)
1.12 @@ -665,6 +665,8 @@
1.13 period of ambiguity.
1.14 """
1.15
1.16 + self._check_pytz()
1.17 +
1.18 try:
1.19 return self._as_olson_datetime()
1.20 except (pytz.UnknownTimeZoneError, pytz.AmbiguousTimeError):
1.21 @@ -679,6 +681,8 @@
1.22
1.23 "Return whether the time is local and ambiguous."
1.24
1.25 + self._check_pytz()
1.26 +
1.27 try:
1.28 self._as_olson_datetime()
1.29 except (pytz.UnknownTimeZoneError, pytz.AmbiguousTimeError):
1.30 @@ -686,6 +690,11 @@
1.31
1.32 return 0
1.33
1.34 + def _check_pytz(self):
1.35 + if not pytz:
1.36 + raise NotImplementedError, "pytz must be installed for Olson " \
1.37 + "time zones to be supported"
1.38 +
1.39 class Timespan(ActsAsTimespan, Convertible):
1.40
1.41 """