[Zope-dev] DateTime.rfc822() bug?

Janko Hauser jh@comunit.de
Tue, 15 Oct 2002 07:17:40 +0200


Lennart Regebro wrote:
> From: "Geir Bækholt" <geirh@funcom.com>
> 
>>i can confirm that this is a bug in DateTime.rfc822(), and that
>>rfc-conformant mailclients choke on it aswell..
> 
> 
> Oh, man, I've looked at DateTime now, and it's a mess... (ar at least, the
> timeone hadnling is).  I'm seriously considering making rfc822() into this:
> 
>     def rfc822(self):
>         """Return the date in RFC 822 format"""
>         return '%s, %2.2d %s %d %2.2d:%2.2d:%2.2d %s' % (
>             self._aday,self._day,self._amon,self._year,
>             self._hour,self._minute,self._nearsec,'-0000')
> 
> That would return the RFC2822 format that explicitly specifies that there is
> no timezone information included... At least that would make it compliant.
> :-/
> 
> A better way would be storing the timzone offset internally in the DateTime
> object and using it, but there timezone handling is spread out all over the
> place, so I haven't really gotten a grip on it yet.
> 

Zope3 already uses the experimental datetime from Python2.3. From a 
quick look it seems to handle timezones. Perhaps you can look there for 
some ideas or use it instead.

HTH,
__Janko