[CMF-checkins] SVN: CMF/branches/2.1/C CMFDefault.File, CMFDefault.Image: Make the ZMI edit tab work.

Tres Seaver tseaver at palladion.com
Wed Jun 25 10:12:18 EDT 2008


Log message for revision 87755:
  CMFDefault.File, CMFDefault.Image:  Make the ZMI edit tab work.
  

Changed:
  U   CMF/branches/2.1/CHANGES.txt
  U   CMF/branches/2.1/CMFDefault/File.py
  U   CMF/branches/2.1/CMFDefault/Image.py

-=-
Modified: CMF/branches/2.1/CHANGES.txt
===================================================================
--- CMF/branches/2.1/CHANGES.txt	2008-06-25 13:48:33 UTC (rev 87754)
+++ CMF/branches/2.1/CHANGES.txt	2008-06-25 14:12:17 UTC (rev 87755)
@@ -2,6 +2,8 @@
 
   Bug Fixes
 
+    - CMFDefault.File, CMFDefault.Image:  Make the ZMI edit tab work.
+
     - CMFDefault DiscussionItem: Fixed indexing of 'in_reply_to'.
 
     - CMFUid.testing: Base UidEventZCMLLayer on ZopeTestCase.layer.ZopeLite.

Modified: CMF/branches/2.1/CMFDefault/File.py
===================================================================
--- CMF/branches/2.1/CMFDefault/File.py	2008-06-25 13:48:33 UTC (rev 87754)
+++ CMF/branches/2.1/CMFDefault/File.py	2008-06-25 14:12:17 UTC (rev 87755)
@@ -76,6 +76,19 @@
     # can span ZODB objects.
     self._getOb(id).manage_upload(file)
 
+#
+#   Fix up PortalContent's over-generalization (OFS.Image.File has
+#   a *method* 'manage_edit', which is supposed to be POSTed to from its
+#   template, 'manage_editForm'.
+#
+manage_options = []
+for mapping in PortalContent.manage_options:
+    mapping = mapping.copy()
+    if mapping['label'] == 'Edit':
+        mapping['action'] = 'manage_editForm'
+    manage_options.append(mapping)
+manage_options.extend(Cacheable.manage_options)
+manage_options = tuple(manage_options)
 
 class File(PortalContent, OFS.Image.File, DefaultDublinCoreImpl):
 
@@ -90,9 +103,7 @@
     effective_date = expiration_date = None
     icon = PortalContent.icon
 
-    manage_options = ( PortalContent.manage_options
-                     + Cacheable.manage_options
-                     )
+    manage_options = manage_options
 
     security = ClassSecurityInfo()
 

Modified: CMF/branches/2.1/CMFDefault/Image.py
===================================================================
--- CMF/branches/2.1/CMFDefault/Image.py	2008-06-25 13:48:33 UTC (rev 87754)
+++ CMF/branches/2.1/CMFDefault/Image.py	2008-06-25 14:12:17 UTC (rev 87755)
@@ -75,6 +75,21 @@
     self._getOb(id).manage_upload(file)
 
 
+#
+#   Fix up PortalContent's over-generalization (OFS.Image.File has
+#   a *method* 'manage_edit', which is supposed to be POSTed to from its
+#   template, 'manage_editForm'.
+#
+manage_options = []
+for mapping in PortalContent.manage_options:
+    mapping = mapping.copy()
+    if mapping['label'] == 'Edit':
+        mapping['action'] = 'manage_editForm'
+    manage_options.append(mapping)
+manage_options.extend(Cacheable.manage_options)
+manage_options = tuple(manage_options)
+
+
 class Image(PortalContent, OFS.Image.Image, DefaultDublinCoreImpl):
 
     """A Portal-managed Image.
@@ -88,9 +103,7 @@
     effective_date = expiration_date = None
     icon = PortalContent.icon
 
-    manage_options = ( PortalContent.manage_options
-                     + Cacheable.manage_options
-                     )
+    manage_options = manage_options
 
     security = ClassSecurityInfo()
 



More information about the CMF-checkins mailing list