开发者

Getting a list of transitions for all workflows in an object's workflow chain

开发者 https://www.devze.com 2023-04-05 03:12 出处:网络
I have an object with two workflows. obj.portal_workflow.getTransitionsFor(obj) returns only transitions from the primary workflow.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号