I have an object with two workflows.
obj.portal_workflow.getTransitionsFor(obj)
returns only transitions from the primary workflow.
I've written the开发者_StackOverflow following code to get a list of all possible transitions for all items in a list.
How am I doing?
transitions = []
for i, obj in enumerate(self.items):
for w in workflow.getWorkflowsFor(obj):
for tid,t in w.transitions.items():
if w.isActionSupported(obj, tid):
if t not in transitions:
transitions.append(t)
return transitions
Campbell
For what I see in the getTransitionsFor source code, it must returns you all transition for all workflows.
http://svn.plone.org/svn/plone/Products.CMFPlone/tags/4.1/Products/CMFPlone/WorkflowTool.py
What you have should work just fine. But you may want to consider using the method already available in @keul's answer.
精彩评论