[CMF-checkins] SVN: CMF/trunk/CMFCore/ Forward port fix for #482
from 2.1 branch.
Tres Seaver
tseaver at palladion.com
Thu Jun 7 12:23:08 EDT 2007
Log message for revision 76467:
Forward port fix for #482 from 2.1 branch.
Changed:
U CMF/trunk/CMFCore/TypesTool.py
U CMF/trunk/CMFCore/tests/test_TypesTool.py
-=-
Modified: CMF/trunk/CMFCore/TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/TypesTool.py 2007-06-07 16:20:51 UTC (rev 76466)
+++ CMF/trunk/CMFCore/TypesTool.py 2007-06-07 16:23:07 UTC (rev 76467)
@@ -726,7 +726,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/trunk/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/tests/test_TypesTool.py 2007-06-07 16:20:51 UTC (rev 76466)
+++ CMF/trunk/CMFCore/tests/test_TypesTool.py 2007-06-07 16:23:07 UTC (rev 76467)
@@ -36,6 +36,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 DummySite
from Products.CMFCore.tests.base.dummy import DummyUserFolder
@@ -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
@@ -80,6 +94,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