[Zope-CMF] adding actions
Karl Anderson
karl@digicool.com
15 Jun 2001 17:40:27 -0700
The source indicate that there will be easier ways to add actions
someday. In the meantime, does this look foolish to anybody?
class CMFDemoActionProvider:
def listActions(self, info):
"Return a list of actions for the actions box."
portal_url = info.portal_url
tour_url = info.portal.tour_URL
actions = [{'name': 'Tour',
'url': tour_url,
'permissions': [],
'category': 'global'},]
if not info.isAnonymous:
actions.extend([{'name': 'Switch Membership',
'url': portal_url + '/XXX',
'permissions' : [],
'category': 'global'},])
return actions
# ... and this method is in the class that instantiates the portal
def _customizeActions(self, portal):
"Add demo actions to the portal actions tool."
#XXX we could have only one provider for all portals
portal.demo_actions_provider = CMFDemoActionProvider()
portal_actions = portal.portal_actions
portal_actions.action_providers = (portal_actions.action_providers +
('demo_actions_provider',))
--
Karl Anderson karl@digicool.com