[Checkins] SVN: zope.session/trunk/ Don't use zope.datetime either. Use standard email.utils.formatdate function.

Dan Korostelev nadako at gmail.com
Mon Mar 16 17:12:35 EDT 2009


Log message for revision 98162:
  Don't use zope.datetime either. Use standard email.utils.formatdate function.

Changed:
  U   zope.session/trunk/CHANGES.txt
  U   zope.session/trunk/setup.py
  U   zope.session/trunk/src/zope/session/http.py

-=-
Modified: zope.session/trunk/CHANGES.txt
===================================================================
--- zope.session/trunk/CHANGES.txt	2009-03-16 19:42:28 UTC (rev 98161)
+++ zope.session/trunk/CHANGES.txt	2009-03-16 21:12:35 UTC (rev 98162)
@@ -14,8 +14,8 @@
   from ``zope.interface`` to make those classes implement `IAttributeAnnotatable`
   again.
 
-- Drop dependency on zope.app.http, use http-date building function
-  from zope.datetime instead.
+- Drop dependency on zope.app.http, use standard date formatting function
+  from the ``email.utils`` module.
 
 - Zope 3 application bootstrapping code for session utilities was moved into
   zope.app.appsetup package, thus drop dependency on zope.app.appsetup in this

Modified: zope.session/trunk/setup.py
===================================================================
--- zope.session/trunk/setup.py	2009-03-16 19:42:28 UTC (rev 98161)
+++ zope.session/trunk/setup.py	2009-03-16 21:12:35 UTC (rev 98162)
@@ -56,7 +56,6 @@
     install_requires=[
         'setuptools',
         'ZODB3',
-        'zope.datetime',
         'zope.component',
         'zope.i18nmessageid',
         'zope.interface',

Modified: zope.session/trunk/src/zope/session/http.py
===================================================================
--- zope.session/trunk/src/zope/session/http.py	2009-03-16 19:42:28 UTC (rev 98161)
+++ zope.session/trunk/src/zope/session/http.py	2009-03-16 21:12:35 UTC (rev 98162)
@@ -27,11 +27,15 @@
 except ImportError:
     # Python 2.4
     from sha import new as sha1
+try:
+    from email.utils import formatdate
+except ImportError:
+    # Python 2.4
+    from email.Utils import formatdate
 
 import zope.location
 from persistent import Persistent
 from zope import schema, component
-from zope.datetime import rfc1123_date
 from zope.interface import implements
 from zope.publisher.interfaces.http import IHTTPRequest
 from zope.publisher.interfaces.http import IHTTPApplicationRequest
@@ -451,7 +455,8 @@
         options = {}
         if self.cookieLifetime is not None:
             if self.cookieLifetime:
-                expires = rfc1123_date(time.time() + self.cookieLifetime)
+                expires = formatdate(time.time() + self.cookieLifetime,
+                                     localtime=False, usegmt=True)
             else:
                 expires = 'Tue, 19 Jan 2038 00:00:00 GMT'
 



More information about the Checkins mailing list