[CMF-checkins] CVS: Products/CMFCore - FSFile.py:1.13 FSImage.py:1.20 utils.py:1.64

Florent Guillaume fg at nuxeo.com
Sun Nov 14 18:59:00 EST 2004


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

Modified Files:
	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.12 => 1.13 ===
--- Products/CMFCore/FSFile.py:1.12	Mon Sep  6 03:57:51 2004
+++ Products/CMFCore/FSFile.py	Sun Nov 14 18:58:30 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.20 ===
--- Products/CMFCore/FSImage.py:1.19	Thu Aug 12 11:07:39 2004
+++ Products/CMFCore/FSImage.py	Sun Nov 14 18:58:30 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.63 => 1.64 ===
--- Products/CMFCore/utils.py:1.63	Wed Nov 10 15:31:14 2004
+++ Products/CMFCore/utils.py	Sun Nov 14 18:58:30 2004
@@ -25,6 +25,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
@@ -285,6 +286,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