[CMF-checkins] CVS: Products/CMFCore - FSFile.py:1.11.2.2
FSImage.py:1.19.2.1 utils.py:1.59.2.5
Florent Guillaume
fg at nuxeo.com
Sun Nov 14 18:52:40 EST 2004
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv20573/CMFCore
Modified Files:
Tag: CMF-1_5-branch
FSFile.py FSImage.py utils.py
Log Message:
FSFile, FSImage: Made available to caching policy manager as
standard content (Collector #299).
=== Products/CMFCore/FSFile.py 1.11.2.1 => 1.11.2.2 ===
--- Products/CMFCore/FSFile.py:1.11.2.1 Mon Sep 6 04:03:33 2004
+++ Products/CMFCore/FSFile.py Sun Nov 14 18:52:10 2004
@@ -30,6 +30,7 @@
from DirectoryView import registerMetaType
from FSObject import FSObject
from utils import _dtmldir
+from utils import _setCacheHeaders, _ViewEmulator
from utils import expandpath
@@ -133,7 +134,10 @@
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Content-Length', len(data))
- self.ZCacheable_set(None)
+ if self.ZCacheable_getManager() is not None:
+ self.ZCacheable_set(None)
+ else:
+ _setCacheHeaders(_ViewEmulator().__of__(self), extra_context={})
return data
security.declareProtected(View, 'getContentType')
=== Products/CMFCore/FSImage.py 1.19 => 1.19.2.1 ===
--- Products/CMFCore/FSImage.py:1.19 Thu Aug 12 11:07:39 2004
+++ Products/CMFCore/FSImage.py Sun Nov 14 18:52:10 2004
@@ -29,7 +29,7 @@
from DirectoryView import registerMetaType
from FSObject import FSObject
from utils import _dtmldir
-from utils import _setCacheHeaders
+from utils import _setCacheHeaders, _ViewEmulator
from utils import expandpath
@@ -129,7 +129,7 @@
if self.ZCacheable_getManager() is not None:
self.ZCacheable_set(None)
else:
- _setCacheHeaders(self, extra_context={})
+ _setCacheHeaders(_ViewEmulator().__of__(self), extra_context={})
return data
security.declareProtected(View, 'getContentType')
=== Products/CMFCore/utils.py 1.59.2.4 => 1.59.2.5 ===
--- Products/CMFCore/utils.py:1.59.2.4 Wed Nov 10 15:31:48 2004
+++ Products/CMFCore/utils.py Sun Nov 14 18:52:10 2004
@@ -26,6 +26,7 @@
from AccessControl.Permission import Permission
from AccessControl.PermissionRole import rolesForPermissionOn
from AccessControl.Role import gather_permissions
+from Acquisition import Implicit
from Acquisition import aq_base
from Acquisition import aq_get
from Acquisition import aq_inner
@@ -343,6 +344,17 @@
RESPONSE.setHeader('X-Cache-Headers-Set-By',
'CachingPolicyManager: %s' %
'/'.join(manager.getPhysicalPath()))
+
+class _ViewEmulator(Implicit):
+ """Auxiliary class used to adapt FSFile and FSImage
+ for caching_policy_manager
+ """
+ def __init__(self, view_name=''):
+ self._view_name = view_name
+
+ def getId(self):
+ return self._view_name
+
#
# Base classes for tools
More information about the CMF-checkins
mailing list