[Zope3-checkins] SVN: Zope3/trunk/src/zope/datetime/ Merged revision 68930 from the 3.3 branch:

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Jun 30 15:25:53 EDT 2006


Log message for revision 68931:
  Merged revision 68930 from the 3.3 branch:
  
  Fixed 'parseDatetimetz', it's now returns offset-naive (not UTC) time
  if no time zone information was found
  

Changed:
  U   Zope3/trunk/src/zope/datetime/__init__.py
  U   Zope3/trunk/src/zope/datetime/tests/test_datetimeparse.py

-=-
Modified: Zope3/trunk/src/zope/datetime/__init__.py
===================================================================
--- Zope3/trunk/src/zope/datetime/__init__.py	2006-06-30 18:46:19 UTC (rev 68930)
+++ Zope3/trunk/src/zope/datetime/__init__.py	2006-06-30 19:25:53 UTC (rev 68931)
@@ -946,8 +946,9 @@
     micro = round(micro * 1000000)
     if tz:
         offset = _tzoffset(tz, None) / 60
+        _tzinfo = tzinfo(offset)
     else:
-        offset = 0
-    return _datetime(y, mo, d, h, m, int(s), int(micro), tzinfo(offset))
+        _tzinfo = None
+    return _datetime(y, mo, d, h, m, int(s), int(micro), _tzinfo)
 
 _iso_tz_re = re.compile("[-+]\d\d:\d\d$")

Modified: Zope3/trunk/src/zope/datetime/tests/test_datetimeparse.py
===================================================================
--- Zope3/trunk/src/zope/datetime/tests/test_datetimeparse.py	2006-06-30 18:46:19 UTC (rev 68930)
+++ Zope3/trunk/src/zope/datetime/tests/test_datetimeparse.py	2006-06-30 19:25:53 UTC (rev 68931)
@@ -96,7 +96,7 @@
         self.assertEqual(parseDatetimetz('1999-12-31T01:02:03.037-00:30'),
                          datetime(1999, 12, 31, 1, 2, 3, 37000, tzinfo(-30)))
         self.assertEqual(parseDatetimetz('2003 6 4 00:00:00 ', local=False),
-                         datetime(2003, 6, 4, tzinfo=tzinfo(0)))
+                         datetime(2003, 6, 4))
 
 def test_suite():
     loader=unittest.TestLoader()



More information about the Zope3-Checkins mailing list