[Zope-CMF] actions tool and categories

J Cameron Cooper jccooper@jcameroncooper.com
Thu, 05 Jun 2003 15:15:06 -0500


>
>
>> I'm confused by the Actions tool. While you can put actions into it 
>> with great variety, there's really only one way to get actions out, 
>> that being the listFilteredActions methods, which filter based on a 
>> hard-coded set of categories. Which makes the categories less useful 
>> than they could be.
>
> The actions tool doesn't filter based on categories.  It filters based 
> on permissions.  It lets any category through, although there is a 
> slight optimization for particular categories that are expected to 
> always be present.

Not really. Unless the category exists, it is not bucketed properly. I 
had thought this was intentional (based on the comments in the 
interface), but on closer inspection, I see it's a bug.

Happily, it's an easy one. Here's my hand diff...

In CMF/CMFCore/ActionsTool.py::

            if verified:
                catlist = filtered_actions.get(category, None)
                if catlist is None:
+                    catlist = filtered_actions[category] = []
 -                   filtered_actions[category] = catlist = []
                # Filter out duplicate actions by identity...
                if not action in catlist:
                    catlist.append(action)

I've tested on CMF 1.3, but this code hasn't changed since then. Can 
someone Just Do This or shall I file a bug? I suppose there should also 
be a unit test for this?

(I guess I won't get to play with the API after all. So sad.)

          --jcc