[CMF-checkins] CVS: CMF/CMFCore - CachingPolicyManager.py:1.3.2.2
Tres Seaver
tseaver@zope.com
Thu, 4 Apr 2002 17:45:54 -0500
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv8439/CMFCore
Modified Files:
Tag: CMF-1_3-branch
CachingPolicyManager.py
Log Message:
- Merge further race fixes.
=== CMF/CMFCore/CachingPolicyManager.py 1.3.2.1 => 1.3.2.2 ===
-def createCPContext( content, view_method, keywords ):
+def createCPContext( content, view_method, keywords, time=None ):
"""
Construct an expression context for TALES expressions,
for use by CachingPolicy objects.
@@ -56,6 +56,9 @@
else:
member = pm.getAuthenticatedMember()
+ if time is None:
+ time = DateTime()
+
data = { 'content' : content
, 'view' : view_method
, 'keywords' : keywords
@@ -63,6 +66,7 @@
, 'member' : member
, 'modules' : SecureModuleImporter
, 'nothing' : None
+ , 'time' : time
}
return getEngine().getContext( data )
@@ -192,7 +196,8 @@
control = []
if self._max_age_secs is not None:
- exp_time_str = rfc1123_date(time.time() + self._max_age_secs)
+ now = expr_context.vars[ 'time' ]
+ exp_time_str = rfc1123_date(now.timeTime() + self._max_age_secs)
headers.append( ( 'Expires', exp_time_str ) )
control.append( 'max-age=%d' % self._max_age_secs )