[egenix-users] Incorrect handle of 2 digit year in ARPA module
M.-A. Lemburg
mal at egenix.com
Tue Sep 20 12:00:52 CEST 2005
Arso - Gentoo wrote:
> This happen on Li nux Gentoo using package egenix-mx-base-2.0.5.
>
> Parsing a date in format 'Wed, 14 Sep 05 11:28:48 +0100' with
> DateTime.ARPA.ParseDateTimeUTC('Wed, 14 Sep 05 11:28:48 +0100')
> occurs the error
>
> File "/usr/lib/python2.3/site-packages/mx/DateTime/ARPA.py", line 155,
> in ParseDateTimeGMT
> return DateTime.DateTime(year,month,day,hour,minute,second) - offset
> TypeError: an integer is required
>
> this becouse after the split in date items at line 133
> litday,day,litmonth,month,year,hour,minute,second,zone = date.groups()
> the missing century is handled by calling
> DateTime.add_century(year)
> while year is string, so the add_century does not work.
>
> I suggest tu use instead on line 135
> DateTime.add_century(atoi(year))
>
> The same on line 67 and 98.
Thanks.
While I'll add support for 2-digit years, I'd like to
encourage everyone to use the 4-digit year representation
instead. This is also the format defined in the documentation
and the one used throughout the Internet nowadays:
http://rfc.sunsite.dk/rfc/rfc2822.html
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Sep 20 2005)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the egenix-users
mailing list