[Zope-CMF] Re: ActionsTool bug on CMFCore trunk

yuppie y.2005- at wcm-solutions.de
Sun Nov 6 11:17:14 EST 2005


Hi Brent!


Brent Hendricks wrote:
> 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

Thanks for reporting this!

Yes. There is a bug. But I believe the bug is something different:

Using getActionObject is no longer necessary for newstyle Action 
objects. If you want to get Action objects, you can get them easily by 
their dotted name or by unrestrictedTraverse.

   tool.category.bar
   tool.unrestrictedTraverse('category/bar')

Making getActionObject return both kinds of IAction objects would be 
confusing because they are quite different objects.

I fixed getActionObject by making it skip newstyle Actions instead of 
raising errors.


Hope that resolves the issue.

Cheers,

	Yuppie



More information about the Zope-CMF mailing list