[wf] fix detection of transition where we've entered a subworkflow stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 08 Oct 2009 12:34:17 +0200
branchstable
changeset 3621 1ec4452aa36f
parent 3618 ad04840ab25c
child 3622 f4317edf4058
[wf] fix detection of transition where we've entered a subworkflow
entities/wfobjs.py
--- a/entities/wfobjs.py	Thu Oct 08 12:00:58 2009 +0200
+++ b/entities/wfobjs.py	Thu Oct 08 12:34:17 2009 +0200
@@ -489,12 +489,13 @@
         if self.main_workflow.eid == self.current_workflow.eid:
             return # doesn't make sense
         subwfentries = []
-        for trinfo in reversed(self.workflow_history):
+        for trinfo in self.workflow_history:
             if (trinfo.transition and
                 trinfo.previous_state.workflow.eid != trinfo.new_state.workflow.eid):
                 # entering or leaving a subworkflow
                 if (subwfentries and
-                    subwfentries[-1].new_state.workflow.eid == trinfo.previous_state.workflow.eid):
+                    subwfentries[-1].new_state.workflow.eid == trinfo.previous_state.workflow.eid and
+                    subwfentries[-1].previous_state.workflow.eid == trinfo.new_state.workflow.eid):
                     # leave
                     del subwfentries[-1]
                 else: