[CMF-checkins] CVS: Products/CMFCore - FSFile.py:1.6.10.4 FSImage.py:1.14.18.4 utils.py:1.39.2.6

Florent Guillaume fg at nuxeo.com
Sun Nov 14 18:15:36 EST 2004


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

Modified Files:
      Tag: CMF-1_4-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.6.10.3 => 1.6.10.4 ===
--- Products/CMFCore/FSFile.py:1.6.10.3	Fri Apr 23 17:11:33 2004
+++ Products/CMFCore/FSFile.py	Sun Nov 14 18:15:06 2004
@@ -22,7 +22,7 @@
 from OFS.Image import File
 from OFS.content_types import guess_content_type
 
-from utils import _dtmldir
+from utils import _dtmldir, _setCacheHeaders, _ViewEmulator
 from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
 from FSObject import FSObject
 from DirectoryView import registerFileExtension, registerMetaType, expandpath
@@ -117,7 +117,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.14.18.3 => 1.14.18.4 ===
--- Products/CMFCore/FSImage.py:1.14.18.3	Wed Jun  2 10:24:49 2004
+++ Products/CMFCore/FSImage.py	Sun Nov 14 18:15:06 2004
@@ -23,7 +23,7 @@
 from webdav.common import rfc1123_date
 from OFS.Image import Image, getImageInfo
 
-from utils import _dtmldir, _setCacheHeaders
+from utils import _dtmldir, _setCacheHeaders, _ViewEmulator
 from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
 from FSObject import FSObject
 from DirectoryView import registerFileExtension, registerMetaType, expandpath
@@ -126,7 +126,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.39.2.5 => 1.39.2.6 ===
--- Products/CMFCore/utils.py:1.39.2.5	Sun Jul 25 16:12:17 2004
+++ Products/CMFCore/utils.py	Sun Nov 14 18:15:06 2004
@@ -24,6 +24,7 @@
 from Globals import MessageDialog
 
 from ExtensionClass import Base
+from Acquisition import Implicit
 from Acquisition import aq_get, aq_inner, aq_parent
 
 from AccessControl import ClassSecurityInfo
@@ -300,6 +301,17 @@
             RESPONSE = REQUEST['RESPONSE']
             for key, value in headers:
                 RESPONSE.setHeader(key, value)
+
+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