[CMF-checkins] CVS: Products/CMFCore - CachingPolicyManager.py:1.4

Andrew Sawyers andrew@zope.com
Thu, 4 Apr 2002 14:58:04 -0500


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv16467/CMFCore

Modified Files:
	CachingPolicyManager.py 
Log Message:

*Changed caching policy manager to user rfc1123_date instead of rfc822


=== Products/CMFCore/CachingPolicyManager.py 1.3 => 1.4 ===
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.utils import _dtmldir
+import time
 
 
 def createCPContext( content, view_method, keywords ):
@@ -184,16 +185,14 @@
                 mtime = DateTime( mtime )
 
             if mtime is not None:
-                mtime_str = mtime.rfc822()
+                mtime_flt = mtime.timeTime()
+                mtime_str = rfc1123_date(mtime_flt)
                 headers.append( ( 'Last-modified', mtime_str ) )
 
             control = []
 
             if self._max_age_secs is not None:
-                max_age_days = float( self._max_age_secs ) / 86400.0
-                exp_time = mtime + max_age_days
-                exp_time_str = exp_time.rfc822()
-
+                exp_time_str = rfc1123_date(time.time() + self._max_age_secs)
                 headers.append( ( 'Expires', exp_time_str ) )
                 control.append( 'max-age=%d' % self._max_age_secs )