[Checkins] SVN: DateTime/trunk/ No longer provide the `DateError`, `DateTimeError`, `SyntaxError` and `TimeError` exceptions as class attributes, import them from their canonical `DateTime.interfaces` location instead.

Hanno Schlichting hannosch at hannosch.eu
Sun May 8 08:00:51 EDT 2011


Log message for revision 121586:
  No longer provide the `DateError`, `DateTimeError`, `SyntaxError` and `TimeError` exceptions as class attributes, import them from their canonical `DateTime.interfaces` location instead.
  

Changed:
  U   DateTime/trunk/CHANGES.txt
  U   DateTime/trunk/src/DateTime/DateTime.py
  U   DateTime/trunk/src/DateTime/DateTime.txt
  U   DateTime/trunk/src/DateTime/tests/testDateTime.py

-=-
Modified: DateTime/trunk/CHANGES.txt
===================================================================
--- DateTime/trunk/CHANGES.txt	2011-05-08 11:48:41 UTC (rev 121585)
+++ DateTime/trunk/CHANGES.txt	2011-05-08 12:00:50 UTC (rev 121586)
@@ -4,6 +4,10 @@
 3.0 (unreleased)
 ----------------
 
+- No longer provide the `DateError`, `DateTimeError`, `SyntaxError` and
+  `TimeError` exceptions as class attributes, import them from their canonical
+  `DateTime.interfaces` location instead.
+
 - Removed deprecated `_isDST` and `_localzone` class variables.
 
 - Moved pytz cache from `DateTime._tzinfo` to a module global `_TZINFO`.

Modified: DateTime/trunk/src/DateTime/DateTime.py
===================================================================
--- DateTime/trunk/src/DateTime/DateTime.py	2011-05-08 11:48:41 UTC (rev 121585)
+++ DateTime/trunk/src/DateTime/DateTime.py	2011-05-08 12:00:50 UTC (rev 121586)
@@ -368,12 +368,6 @@
     __roles__ = None
     __allow_access_to_unprotected_subobjects__ = 1
 
-    # Make class-specific exceptions available as attributes.
-    DateError = DateError
-    TimeError = TimeError
-    DateTimeError = DateTimeError
-    SyntaxError = SyntaxError
-
     int_pattern  =re.compile(r'([0-9]+)') #AJ
     flt_pattern  =re.compile(r':([0-9]+\.[0-9]+)') #AJ
     name_pattern =re.compile(r'([a-zA-Z]+)', re.I) #AJ

Modified: DateTime/trunk/src/DateTime/DateTime.txt
===================================================================
--- DateTime/trunk/src/DateTime/DateTime.txt	2011-05-08 11:48:41 UTC (rev 121585)
+++ DateTime/trunk/src/DateTime/DateTime.txt	2011-05-08 12:00:50 UTC (rev 121586)
@@ -200,8 +200,8 @@
   the specified timezone).
 
 If a string argument passed to the DateTime constructor cannot be
-parsed, it will raise DateTime.SyntaxError.  Invalid date, time, or
-timezone components will raise a DateTime.DateTimeError.
+parsed, it will raise SyntaxError.  Invalid date, time, or
+timezone components will raise a DateTimeError.
 
 The module function Timezones() will return a list of the timezones
 recognized by the DateTime module.  Recognition of timezone names is

Modified: DateTime/trunk/src/DateTime/tests/testDateTime.py
===================================================================
--- DateTime/trunk/src/DateTime/tests/testDateTime.py	2011-05-08 11:48:41 UTC (rev 121585)
+++ DateTime/trunk/src/DateTime/tests/testDateTime.py	2011-05-08 12:00:50 UTC (rev 121586)
@@ -484,10 +484,11 @@
                     self.assertEqual(d_us, d_int)
 
     def test_calcTimezoneName(self):
+        from DateTime.interfaces import TimeError
         timezone_dependent_epoch = 2177452800L
         try:
             DateTime()._calcTimezoneName(timezone_dependent_epoch, 0)
-        except DateTime.TimeError:
+        except TimeError:
             self.fail('Zope Collector issue #484 (negative time bug): '
                       'TimeError raised')
 



More information about the checkins mailing list