[CMF-checkins] SVN: CMF/trunk/C Forward port fix for #232 from 2.0 branch.

Tres Seaver tseaver at palladion.com
Mon Sep 4 20:12:35 EDT 2006


Log message for revision 69966:
  Forward port fix for #232 from 2.0 branch.

Changed:
  U   CMF/trunk/CHANGES.txt
  U   CMF/trunk/CMFCore/ActionInformation.py
  U   CMF/trunk/CMFCore/tests/test_ActionInformation.py

-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt	2006-09-05 00:10:37 UTC (rev 69965)
+++ CMF/trunk/CHANGES.txt	2006-09-05 00:12:34 UTC (rev 69966)
@@ -15,6 +15,9 @@
 
   Bug Fixes
 
+    - CMFCore.ActionInformation: don't use a fixed set of properties for
+      ActionInformation. (http://www.zope.org/Collectors/CMF/232/)
+
     - CMFCore.CatalogTool: Use current executable's proxy roles, if any,
       in place of user's roles when computing 'allowedRolesAndUsers' for
       a query. (http://www.zope.org/Collectors/CMF/380)

Modified: CMF/trunk/CMFCore/ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/ActionInformation.py	2006-09-05 00:10:37 UTC (rev 69965)
+++ CMF/trunk/CMFCore/ActionInformation.py	2006-09-05 00:12:34 UTC (rev 69966)
@@ -22,6 +22,7 @@
 from Globals import InitializeClass
 from OFS.ObjectManager import IFAwareObjectManager
 from OFS.OrderedFolder import OrderedFolder
+from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import SimpleItem
 from zope.i18nmessageid import Message
 from zope.interface import implements
@@ -35,7 +36,6 @@
 from utils import _checkPermission
 from utils import _wwwdir
 from utils import getToolByName
-from utils import SimpleItemWithProperties
 
 
 _unchanged = [] # marker
@@ -69,7 +69,7 @@
 InitializeClass(ActionCategory)
 
 
-class Action(SimpleItemWithProperties):
+class Action(PropertyManager, SimpleItem):
 
     """ Reference to an action.
     """
@@ -99,6 +99,10 @@
          'label': 'Visible?'},
         )
 
+    manage_options = (
+        PropertyManager.manage_options
+        + SimpleItem.manage_options)
+
     def __init__(self, id, **kw):
         self.id = id
         self._setPropValue( 'title', kw.get('title', '') )

Modified: CMF/trunk/CMFCore/tests/test_ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_ActionInformation.py	2006-09-05 00:10:37 UTC (rev 69965)
+++ CMF/trunk/CMFCore/tests/test_ActionInformation.py	2006-09-05 00:12:34 UTC (rev 69966)
@@ -97,7 +97,41 @@
                    ['url', 'icon'] )
         self.assertEqual( a.getInfoData(), WANTED )
 
+    def test_manage_propertiesForm_allows_adding(self):
+        from OFS.SimpleItem import SimpleItem
+        def _header(*args, **kw):
+            return 'HEADER'
+        def _footer(*args, **kw):
+            return 'HEADER'
+        container = SimpleItem()
 
+        container.REQUEST = request = DummyRequest()
+        request.set('manage_page_header', _header)
+        request.set('manage_page_footer', _footer)
+        request.set('BASEPATH1', '/one/two')
+        request.set('URL1', '/one/two')
+        request._steps = ['one', 'two']
+
+        prd = {'ac_permissions': ('a', 'b')}
+        container._getProductRegistryData = prd.get
+
+        a = self._makeOne('extensible').__of__(container)
+        form_html = a.manage_propertiesForm(request)
+
+        self.failUnless('value=" Add "' in form_html)
+
+class DummyRequest:
+    def __init__(self):
+        self._data = {}
+    def set(self, k, v):
+        self._data[k] = v
+    def get(self, k, default):
+        return self._data.get(k, default)
+    def __getitem__(self, k):
+        return self._data[k]
+    def __len__(self):
+        return len(self._data)
+
 class ActionInfoTests(unittest.TestCase):
 
     def _makeOne(self, *args, **kw):



More information about the CMF-checkins mailing list