[CMF-checkins] SVN: CMF/branches/2.1/C Pass 'object' through to TypeInformation objects' 'listActions'.

Tres Seaver tseaver at palladion.com
Thu Jun 7 12:20:52 EDT 2007


Log message for revision 76466:
  Pass 'object' through to TypeInformation objects' 'listActions'.
  
  o http://www.zope.org/Collectors/CMF/482
  

Changed:
  U   CMF/branches/2.1/CHANGES.txt
  U   CMF/branches/2.1/CMFCore/TypesTool.py
  U   CMF/branches/2.1/CMFCore/tests/test_TypesTool.py

-=-
Modified: CMF/branches/2.1/CHANGES.txt
===================================================================
--- CMF/branches/2.1/CHANGES.txt	2007-06-07 15:42:51 UTC (rev 76465)
+++ CMF/branches/2.1/CHANGES.txt	2007-06-07 16:20:51 UTC (rev 76466)
@@ -2,19 +2,22 @@
 
   Bug Fixes
 
-    - Removed extraneous "Cache" tab from FS-based skin objects
-      http://www.zope.org/Collectors/CMF/343
+    - Pass 'object' through to TypeInformation objects' 'listActions'.
+      (http://www.zope.org/Collectors/CMF/482)
+      
+    - Removed extraneous "Cache" tab from FS-based skin objects.
+      (http://www.zope.org/Collectors/CMF/343)
 
     - CMFCore.WorkflowTool: Using the '(Default)' keyword for a type's 
-      workflow chain will now reset any custom workflow chains for the type
+      workflow chain will now reset any custom workflow chains for the type.
       (http://www.zope.org/Collectors/CMF/475)
 
     - Use the property API to get the member specific skin, because
       direct attribute access won't work with PAS based membership.
       (http://dev.plone.org/plone/ticket/5904)
 
-    - Add POST-only protections to security critical methods (see
-      http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0240).
+    - Add POST-only protections to security critical methods.
+      http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0240)
 
     - Allow customization from DirectoryViews to be redirected into
       alternate folders, and use manually-built clones.

Modified: CMF/branches/2.1/CMFCore/TypesTool.py
===================================================================
--- CMF/branches/2.1/CMFCore/TypesTool.py	2007-06-07 15:42:51 UTC (rev 76465)
+++ CMF/branches/2.1/CMFCore/TypesTool.py	2007-06-07 16:20:51 UTC (rev 76466)
@@ -734,7 +734,7 @@
         if object is not None:
             type_info = self.getTypeInfo(object)
             if type_info is not None:
-                actions.extend( type_info.listActions() )
+                actions.extend( type_info.listActions(info, object) )
 
         return actions
 

Modified: CMF/branches/2.1/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/branches/2.1/CMFCore/tests/test_TypesTool.py	2007-06-07 15:42:51 UTC (rev 76465)
+++ CMF/branches/2.1/CMFCore/tests/test_TypesTool.py	2007-06-07 16:20:51 UTC (rev 76466)
@@ -35,6 +35,7 @@
 from Products.CMFCore.testing import FunctionalZCMLLayer
 from Products.CMFCore.tests.base.dummy import DummyFactory
 from Products.CMFCore.tests.base.dummy import DummyFactoryDispatcher
+from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummyFolder
 from Products.CMFCore.tests.base.dummy import DummyObject
 from Products.CMFCore.tests.base.dummy import DummySite
@@ -48,7 +49,20 @@
 from Products.CMFCore.tests.base.tidata import FTIDATA_DUMMY
 from Products.CMFCore.tests.base.tidata import STI_SCRIPT
 
+from zope.interface import implements
+from Products.CMFCore.interfaces import ITypeInformation
 
+class ActionTesterTypeInfo:
+
+    implements(ITypeInformation)
+
+    id = 'Dummy Content'
+
+    def listActions(self, info=None, obj=None):
+        self._action_info = info
+        self._action_obj = obj
+        return ()
+
 class TypesToolTests(SecurityTest, WarningInterceptor):
 
     layer = FunctionalZCMLLayer
@@ -92,6 +106,20 @@
         verifyClass(IActionProvider, TypesTool)
         verifyClass(ITypesTool, TypesTool)
 
+    def test_listActions(self):
+        """test that a full set of context information is passed
+           by the types tool
+        """
+        tool = self.ttool
+        ti = ActionTesterTypeInfo()
+        setattr( tool, 'Dummy Content', ti )
+
+        dummy = self.site._setObject('dummy', DummyContent('dummy'))
+        tool.listActions('fake_info', dummy)
+
+        self.assertEqual(ti._action_info, 'fake_info')
+        self.assertEqual(ti._action_obj, dummy)
+
     def test_allMetaTypes(self):
         """
         Test that everything returned by allMetaTypes can be



More information about the CMF-checkins mailing list