[ZCM] [ZC] 2291/ 2 Edit "DateTime trouble parsing daylight savings time"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Thu Mar 15 00:29:05 EDT 2007


Issue #2291 Update (Edit) "DateTime trouble parsing daylight savings time"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2291

==============================================================
= Edit - Entry #2 by ajung on Mar 15, 2007 12:29 am

 Changes: submitter email, importance (critical => medium), new comment

This is not critical
________________________________________
= Request - Entry #1 by bticc on Mar 14, 2007 11:06 pm

DateTime is raising a SyntaxError when encountering datetime strings that have daylight savings time zones such as EDT, CDT, MDT, PDT. This can be tested as follows:

[pts6][zope at horus DateTime]$ python
Python 2.4.3 (#1, Jun 14 2006, 14:53:31)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from DateTime import DateTime
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 EDT')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 555, in __init__
    return self._parse_args(*args, **kw)
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 798, in _parse_args
    yr,mo,dy,hr,mn,sc,tz=self._parse(arg, datefmt)
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 1087, in _parse
    raise SyntaxError, st
DateTime.SyntaxError: Wed, 14 Mar 2007 09:44:06 EDT
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 EST')
>>> print dt.timezone()
US/Eastern
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 CDT')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 555, in __init__
    return self._parse_args(*args, **kw)
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 798, in _parse_args
    yr,mo,dy,hr,mn,sc,tz=self._parse(arg, datefmt)
  File "/usr/lib/zope2/lib/python/DateTime/DateTime.py", line 1087, in _parse
    raise SyntaxError, st
DateTime.SyntaxError: Wed, 14 Mar 2007 09:44:06 CDT
>>> dt = DateTime('Wed, 14 Mar 2007 09:44:06 CST')
>>> print dt.timezone()
US/Central

The results are the same for Mountain and pacific time as well. 

I have not yet found a fix for this problem. I discovered it using PloneFeedFeeder when trying to parse a news feed with the datetime stamp used in this example.


==============================================================



More information about the Zope-Collector-Monitor mailing list