[CMF-checkins] CVS: Products/CMFDefault - File.py:1.29 Image.py:1.27

Stefan H. Holek stefan at epy.co.at
Sat Jul 31 10:30:27 EDT 2004


Update of /cvs-repository/Products/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv29847/CMFDefault

Modified Files:
	File.py Image.py 
Log Message:
setFormat() failed to update the content_type property causing index_html() to use 
a stale mimetype when serving the file or image.
Also see http://collector.zope.org/CMF/226


=== Products/CMFDefault/File.py 1.28 => 1.29 ===
--- Products/CMFDefault/File.py:1.28	Thu Apr 29 12:13:17 2004
+++ Products/CMFDefault/File.py	Sat Jul 31 10:29:52 2004
@@ -206,8 +206,6 @@
         if self._isNotEmpty(file):
             self.manage_upload(file)
 
-        self.setFormat(self.content_type)
-
     security.declareProtected(ModifyPortalContent, 'edit')
     def edit(self, precondition='', file=''):
         """ Update and reindex. """
@@ -233,6 +231,16 @@
         RESPONSE.setHeader('Content-Disposition',
                            'attachment; filename=%s' % self.getId())
         return OFS.Image.File.index_html(self, REQUEST, RESPONSE)
+
+    security.declareProtected(View, 'Format')
+    def Format(self):
+        """ Dublin Core element - resource format """
+        return self.content_type
+
+    security.declareProtected(ModifyPortalContent, 'setFormat')
+    def setFormat(self, format):
+        """ Dublin Core element - resource format """
+        self.manage_changeProperties(content_type=format)
 
     security.declareProtected(ModifyPortalContent, 'PUT')
     def PUT(self, REQUEST, RESPONSE):


=== Products/CMFDefault/Image.py 1.26 => 1.27 ===
--- Products/CMFDefault/Image.py:1.26	Thu Apr 29 12:13:17 2004
+++ Products/CMFDefault/Image.py	Sat Jul 31 10:29:52 2004
@@ -198,8 +198,6 @@
         if self._isNotEmpty(file):
             self.manage_upload(file)
 
-        self.setFormat(self.content_type)
-
     security.declareProtected(ModifyPortalContent, 'edit')
     def edit(self, precondition='', file=''):
         """ Update and reindex. """
@@ -217,6 +215,16 @@
         #if REQUEST['PATH_INFO'][-10:] == 'index_html':
         #    return self.view(self, REQUEST)
         return OFS.Image.Image.index_html(self, REQUEST, RESPONSE)
+
+    security.declareProtected(View, 'Format')
+    def Format(self):
+        """ Dublin Core element - resource format """
+        return self.content_type
+
+    security.declareProtected(ModifyPortalContent, 'setFormat')
+    def setFormat(self, format):
+        """ Dublin Core element - resource format """
+        self.manage_changeProperties(content_type=format)
 
     security.declareProtected(ModifyPortalContent, 'PUT')
     def PUT(self, REQUEST, RESPONSE):



More information about the CMF-checkins mailing list