From: "Janko Hauser" <[EMAIL PROTECTED]>
> 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.

It seems too risky to use experimental features from a version of python
that is ahead of the python version used by the rest of Zope 2.6.

I've solved it like this:

def _tzoffset2rfc822zone(seconds):
    return "%+03d%02d" % divmod( (-seconds/60), 60)

   def rfc822(self):
        """Return the date in RFC 822 format"""
        if self._tz == self._localzone0: #Use local standard time
            tzoffset = _tzoffset2rfc822zone(localzone)
        elif self._tz == self._localzone1: # Use local daylight saving time
            tzoffset = _tzoffset2rfc822zone(altzone)
            tzoffset = '-0000' # unknown time zone offset

        return '%s, %2.2d %s %d %2.2d:%2.2d:%2.2d %s' % (

This will give you the correct timezone information in almost all cases.
Only when rfc822() is called on a DateTime which is in another timezone than
the server will '-0000' be used.

Best Regards

Lennart Regebro
Torped Strategi och Kommunikation AB

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to