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

Tres Seaver tseaver@zope.com
Thu, 4 Apr 2002 16:28:12 -0500


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv19097

Modified Files:
      Tag: CMF-1_3-branch
	CachingPolicyManager.py 
Log Message:
 - Merge Andrew's fixes for CPM emitting improper dates.

=== CMF/CMFCore/CachingPolicyManager.py 1.3 => 1.3.2.1 ===
 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 )