[CMF-checkins] CVS: Products/CMFCore - WorkflowTool.py:1.19
Tres Seaver
tseaver@zope.com
Thu, 20 Dec 2001 16:30:07 -0500
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv5962/CMFCore
Modified Files:
WorkflowTool.py
Log Message:
- Enabled querying actions from workflow tool in absence
of actions tool (Tracker #401).
=== Products/CMFCore/WorkflowTool.py 1.18 => 1.19 ===
_marker = [] # Create a new marker object.
+class WorkflowInformation:
+ """
+ Shim implementation of ActionInformation, to enable
+ querying actions without mediation of the 'portal_actions' tool.
+ """
+ def __init__(self, object):
+ self.content = object
+ self.content_url = object.absolute_url()
+ self.portal_url = self.folder_url = ''
+
+ def __getitem__(self, name):
+ if name[:1] == '_':
+ raise KeyError, name
+ if hasattr(self, name):
+ return getattr(self, name)
+ raise KeyError, name
+
class WorkflowTool (UniqueObject, Folder):
'''
@@ -345,6 +362,14 @@
if v is not None:
vars.update(v)
return vars
+
+ security.declarePublic('getActionsFor')
+ def getActionsFor(self, ob):
+ '''
+ Return a list of action dictionaries for 'ob', just as though
+ queried via 'ActionsTool.listFilteredActionsFor'.
+ '''
+ return self.listActions( WorkflowInformation( ob ) )
security.declarePrivate('listActions')
def listActions(self, info):