[Zope-CMF] How can I use the portal_actions tool

Karl Anderson karl@digicool.com
09 Jul 2001 15:30:47 -0700


Robert Rottermann <robert@redcor.ch> writes:

> Can I use the portal_actions toll to add actions to the portal itself. If
> yes how?

I did this in a Q&D way by creating an object instance that did what
an action provider does and adding it to the actions tool:

        portal.demo_actions_provider = CMFDemoActionProvider()
        portal_actions = getToolByName(portal, "portal_actions")
        portal_actions.action_providers = (portal_actions.action_providers +
                                           ('demo_actions_provider',))

The CMfDemoActionProvider class only supported the listActions()
method, which returns a list of dicts for making links.

-- 
Karl Anderson                          karl@digicool.com