[CMF-checkins] CVS: Products/CMFDefault - File.py:1.25.4.3 Image.py:1.23.4.3

Stefan H. Holek stefan at epy.co.at
Tue Jul 27 17:35:46 EDT 2004


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

Modified Files:
      Tag: CMF-1_4-branch
	File.py Image.py 
Log Message:
Fix for DC.format and content_type running out of sync in Image and File.


=== Products/CMFDefault/File.py 1.25.4.2 => 1.25.4.3 ===
--- Products/CMFDefault/File.py:1.25.4.2	Thu Apr 22 13:47:50 2004
+++ Products/CMFDefault/File.py	Tue Jul 27 17:35:15 2004
@@ -204,8 +204,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. """
@@ -232,11 +230,20 @@
                            '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):
         """ Handle HTTP (and presumably FTP?) PUT requests """
         OFS.Image.File.PUT( self, REQUEST, RESPONSE )
         self.reindexObject()
-
 
 InitializeClass(File)


=== Products/CMFDefault/Image.py 1.23.4.2 => 1.23.4.3 ===
--- Products/CMFDefault/Image.py:1.23.4.2	Thu Apr 22 13:47:50 2004
+++ Products/CMFDefault/Image.py	Tue Jul 27 17:35:15 2004
@@ -196,8 +196,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. """
@@ -215,6 +213,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