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

_______________________________________________
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

Reply via email to