[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ Image, File: make ZMI 'edit' view work.

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


Log message for revision 87759:
  Image, File:  make ZMI 'edit' view work.

Changed:
  U   Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
  U   Products.CMFDefault/trunk/Products/CMFDefault/File.py
  U   Products.CMFDefault/trunk/Products/CMFDefault/Image.py

-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt	2008-06-25 14:21:39 UTC (rev 87758)
+++ Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt	2008-06-25 14:25:51 UTC (rev 87759)
@@ -2,6 +2,8 @@
 
   Products.CMFDefault 2.2.0 (unreleased)
 
+    - Image, File:  make ZMI "edit" view work.
+
     - views: Added ContentEditFormBase and FileAddView.
       This shows how form-driven content creation works. The content is created
       without using the constructor methods provided by the types tool.

Modified: Products.CMFDefault/trunk/Products/CMFDefault/File.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/File.py	2008-06-25 14:21:39 UTC (rev 87758)
+++ Products.CMFDefault/trunk/Products/CMFDefault/File.py	2008-06-25 14:25:51 UTC (rev 87759)
@@ -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):
 
@@ -87,9 +100,7 @@
     effective_date = expiration_date = None
     icon = PortalContent.icon
 
-    manage_options = ( PortalContent.manage_options
-                     + Cacheable.manage_options
-                     )
+    manage_options = manage_options
 
     security = ClassSecurityInfo()
 

Modified: Products.CMFDefault/trunk/Products/CMFDefault/Image.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/Image.py	2008-06-25 14:21:39 UTC (rev 87758)
+++ Products.CMFDefault/trunk/Products/CMFDefault/Image.py	2008-06-25 14:25:51 UTC (rev 87759)
@@ -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.
@@ -85,9 +100,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 Checkins mailing list