thirdparty/google_appengine/google/appengine/cron/groctimespecification.py
changeset 2864 2e0b0af889be
parent 2172 ac7bd3b467ff
--- a/thirdparty/google_appengine/google/appengine/cron/groctimespecification.py	Sat Sep 05 14:04:24 2009 +0200
+++ b/thirdparty/google_appengine/google/appengine/cron/groctimespecification.py	Sun Sep 06 23:31:53 2009 +0200
@@ -47,9 +47,12 @@
 
 try:
   from pytz import NonExistentTimeError
+  from pytz import AmbiguousTimeError
 except ImportError:
   class NonExistentTimeError(Exception):
     pass
+  class AmbiguousTimeError(Exception):
+    pass
 
 
 def GrocTimeSpecification(schedule):
@@ -119,7 +122,7 @@
   """
 
   def __init__(self, interval, period):
-    super(IntervalTimeSpecification, self).__init__(self)
+    super(IntervalTimeSpecification, self).__init__()
     self.interval = interval
     self.period = period
 
@@ -286,13 +289,15 @@
                                       microsecond=0)
         if self.timezone and pytz is not None:
           try:
+            out = self.timezone.localize(out, is_dst=None)
+          except AmbiguousTimeError:
             out = self.timezone.localize(out)
-          except (NonExistentTimeError, IndexError):
+          except NonExistentTimeError:
             for _ in range(24):
               out = out.replace(minute=1) + datetime.timedelta(minutes=60)
               try:
                 out = self.timezone.localize(out)
-              except (NonExistentTimeError, IndexError):
+              except NonExistentTimeError:
                 continue
               break
           out = out.astimezone(pytz.utc)