[CMF-checkins] CVS: CMF/CMFCore - FSPageTemplate.py:1.8.8.2
Tres Seaver
tseaver@zope.com
Thu, 1 Aug 2002 14:24:23 -0400
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv2442/CMFCore
Modified Files:
Tag: CMF-1_3-branch
FSPageTemplate.py
Log Message:
- Make the extra 'content-type' emission backwards compatible with
Zope 2.4 & 2.5.
=== CMF/CMFCore/FSPageTemplate.py 1.8.8.1 => 1.8.8.2 ===
else:
raise
+ security.declarePrivate( '_ZPT_exec' )
+ _ZPT_exec = ZopePageTemplate._exec
+
+ security.declarePrivate( '_exec' )
def _exec(self, bound_names, args, kw):
"""Call a FSPageTemplate"""
- if not kw.has_key('args'):
- kw['args'] = args
- bound_names['options'] = kw
-
try:
response = self.REQUEST.RESPONSE
except AttributeError:
response = None
-
- security=getSecurityManager()
- bound_names['user'] = security.getUser()
-
- # Retrieve the value from the cache.
- keyset = None
- if self.ZCacheable_isCachingEnabled():
- # Prepare a cache key.
- keyset = {'here': self._getContext(),
- 'bound_names': bound_names}
- result = self.ZCacheable_get(keywords=keyset)
- if result is not None:
- # Got a cached value.
- if response is not None:
- response.setHeader('content-type',self.content_type)
- return result
-
- # Execute the template in a new security context.
- security.addContext(self)
- try:
- result = self.pt_render(extra_context=bound_names)
- if response is not None:
- # content_type may not have been cooked until now
- response.setHeader('content-type',self.content_type)
- if keyset is not None:
- # Store the result in the cache.
- self.ZCacheable_set(result, keywords=keyset)
- return result
- finally:
- security.removeContext(self)
-
+ # call "inherited"
+ result = self._ZPT_exec( bound_names, args, kw )
+ if response is not None:
+ response.setHeader( 'content-type', self.content_type )
+ return result
+
# Copy over more methods
security.declareProtected(FTPAccess, 'manage_FTPget')
security.declareProtected(View, 'get_size')