[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/datetime/ Fixed 'parseDatetimetz', it's now returns offset-naive (not UTC) time

Dmitry Vasiliev dima at hlabs.spb.ru
Fri Jun 30 14:46:20 EDT 2006


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

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

-=-
Modified: Zope3/branches/3.3/src/zope/datetime/__init__.py
===================================================================
--- Zope3/branches/3.3/src/zope/datetime/__init__.py	2006-06-30 15:36:30 UTC (rev 68929)
+++ Zope3/branches/3.3/src/zope/datetime/__init__.py	2006-06-30 18:46:19 UTC (rev 68930)
@@ -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/branches/3.3/src/zope/datetime/tests/test_datetimeparse.py
===================================================================
--- Zope3/branches/3.3/src/zope/datetime/tests/test_datetimeparse.py	2006-06-30 15:36:30 UTC (rev 68929)
+++ Zope3/branches/3.3/src/zope/datetime/tests/test_datetimeparse.py	2006-06-30 18:46:19 UTC (rev 68930)
@@ -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