[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/DateTime.py wrapped the complete DateTime parser magic into try..except

Andreas Jung andreas at andreas-jung.com
Fri Jul 30 06:38:44 EDT 2004


Log message for revision 26844:
  wrapped the complete DateTime parser magic into try..except
  for a better and unique error handling
  


Changed:
  U   Zope/trunk/lib/python/DateTime/DateTime.py


-=-
Modified: Zope/trunk/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/trunk/lib/python/DateTime/DateTime.py	2004-07-30 09:32:52 UTC (rev 26843)
+++ Zope/trunk/lib/python/DateTime/DateTime.py	2004-07-30 10:38:44 UTC (rev 26844)
@@ -497,6 +497,15 @@
     SyntaxError = SyntaxError
 
     def __init__(self,*args, **kw):
+        """Return a new date-time object"""
+
+        try:
+            return self._parse_args(*args, **kw)
+        except:
+            raise SyntaxError('Unable to parse %s, %s' % (args, kw))
+
+
+    def _parse_args(self, *args, **kw):
         """Return a new date-time object
 
         A DateTime object always maintains its value as an absolute



More information about the Zope-Checkins mailing list