def listFilteredActionsFor(self, object=None): """ List all actions available to the user. """ actions = [] # Include actions from specific tools. for provider_name in self.listActionProviders(): provider = getattr(self, provider_name) if IActionProvider.providedBy(provider) or \ z2IActionProvider.isImplementedBy(provider): actions.extend(provider.listActionInfos(object=object)) # Include actions from object. if object is not None: if IActionProvider.providedBy(object) or \ z2IActionProvider.isImplementedBy(object): actions.extend(object.listActionInfos(object=object)) # Reorganize the actions by category. filtered_actions = { 'user': [], 'folder': [], 'object': [], 'global': [], 'workflow': [], } for action in actions: catlist = filtered_actions.setdefault(action['category'], []) catlist.append(action) return filtered_actions
def listFilteredActionsFor(self, object=None): """ List all actions available to the user. """ actions = [] # Include actions from specific tools. for provider_name in self.listActionProviders(): provider = getattr(self, provider_name) if IActionProvider.providedBy(provider) or \ z2IActionProvider.isImplementedBy(provider): actions.extend( provider.listActionInfos(object=object) ) # Include actions from object. if object is not None: if IActionProvider.providedBy(object) or \ z2IActionProvider.isImplementedBy(object): actions.extend( object.listActionInfos(object=object) ) # Reorganize the actions by category. filtered_actions={'user':[], 'folder':[], 'object':[], 'global':[], 'workflow':[], } for action in actions: catlist = filtered_actions.setdefault(action['category'], []) catlist.append(action) return filtered_actions