[Zope-Checkins] SVN: Zope/trunk/ Merged
Zope/branches/regebro-strftime_1127 28397:28400;
bugfix for issue #1127
Lennart Regebro
regebro at nuxeo.com
Mon Nov 8 12:20:16 EST 2004
Log message for revision 28402:
Merged Zope/branches/regebro-strftime_1127 28397:28400; bugfix for issue #1127
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/DateTime/DateTime.py
U Zope/trunk/lib/python/DateTime/tests/testDateTime.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2004-11-08 16:56:33 UTC (rev 28401)
+++ Zope/trunk/doc/CHANGES.txt 2004-11-08 17:20:15 UTC (rev 28402)
@@ -36,6 +36,8 @@
Statistics view in the ZMI
Bugs fixed
+
+ - Collector #1127: strftime did not take timezone into account.
- ZPublisher: changed some hardcoded 'latin1' arguments to 'iso-8859-15'
since latin1 is obsolete.
Modified: Zope/trunk/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/trunk/lib/python/DateTime/DateTime.py 2004-11-08 16:56:33 UTC (rev 28401)
+++ Zope/trunk/lib/python/DateTime/DateTime.py 2004-11-08 17:20:15 UTC (rev 28402)
@@ -1476,11 +1476,7 @@
def strftime(self, format):
# Format the date/time using the *current timezone representation*.
- diff = _tzoffset(self._tz, self._t)
- format = re.sub('(^\|[^%])%z',
- '\\1%+05d' % (diff / 36),
- format)
- return strftime(format, safegmtime(self.timeTime() + diff))
+ return strftime(format, safelocaltime(self.timeTime()))
# General formats from previous DateTime
def Date(self):
Modified: Zope/trunk/lib/python/DateTime/tests/testDateTime.py
===================================================================
--- Zope/trunk/lib/python/DateTime/tests/testDateTime.py 2004-11-08 16:56:33 UTC (rev 28401)
+++ Zope/trunk/lib/python/DateTime/tests/testDateTime.py 2004-11-08 17:20:15 UTC (rev 28402)
@@ -7,6 +7,7 @@
import time
import unittest
+from DateTime.DateTime import _findLocalTimeZoneName
from DateTime import DateTime
try:
@@ -338,6 +339,16 @@
except DateTime.TimeError:
self.fail('Zope Collector issue #484 (negative time bug): '
'TimeError raised')
+
+ def testStrftimeTZhandling(self):
+ '''strftime timezone testing'''
+ # This is a test for collector issue #1127
+ format = '%Y-%m-%d %H:%M %Z'
+ dt = DateTime('Wed, 19 Nov 2003 18:32:07 -0215')
+ dt_string = dt.strftime(format)
+ dt_local = dt.toZone(_findLocalTimeZoneName(0))
+ dt_localstring = dt_local.strftime(format)
+ self.assertEqual(dt_string, dt_localstring)
def test_suite():
More information about the Zope-Checkins
mailing list