I believe I have discovered a bug in CMFCore/ActionsTool.py on the trunk. The implementation of getActionObject() which it inherits from ActionProviderBase seems to be expecting self.listActions() to return ActionInformation objects since it calls getCategory() on them. But newly created instances now have Action objects instead which have no such method.
This test case illustrates the bug: def test_getActionObject(self): tool = self.tool tool.manage_addProduct['CMFCore'].manage_addActionCategory('category') tool.category.manage_addProduct['CMFCore'].manage_addAction('bar') action = tool.getActionObject('category/bar') self.assertEquals(action.getId(), 'bar') I've attached a patch that I believe fixes it Brent
Index: ActionsTool.py =================================================================== --- ActionsTool.py (revision 39941) +++ ActionsTool.py (working copy) @@ -119,6 +119,32 @@ actions.extend( category.listActions() ) return tuple(actions) + + security.declarePrivate('getActionObject') + def getActionObject(self, action): + """Return the actions object or None if action doesn't exist. + """ + # separate cataegory and id from action + sep = action.rfind('/') + if sep == -1: + raise ValueError('Actions must have the format <category>/<id>.') + category, id = action[:sep], action[sep+1:] + + try: + cat = getattr(self.aq_base, category) + except AttributeError: + # No such category + return None + + # search for action and return first one found + for ai in cat.listActions(): + if id == ai.getId(): + return ai + + # no action found + return None + + # # Programmatically manipulate the list of action providers #
_______________________________________________ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests