equal
deleted
inserted
replaced
474 statename)) |
474 statename)) |
475 stateeid = state.eid |
475 stateeid = state.eid |
476 # XXX try to find matching transition? |
476 # XXX try to find matching transition? |
477 return self._add_trinfo(comment, commentformat, tr and tr.eid, stateeid) |
477 return self._add_trinfo(comment, commentformat, tr and tr.eid, stateeid) |
478 |
478 |
|
479 def subworkflow_input_transition(self): |
|
480 """return the transition which has went through the current sub-workflow |
|
481 """ |
|
482 if self.main_workflow.eid == self.current_workflow.eid: |
|
483 return # doesn't make sense |
|
484 subwfentries = [] |
|
485 for trinfo in reversed(self.workflow_history): |
|
486 if (trinfo.transition and |
|
487 trinfo.previous_state.workflow.eid != trinfo.new_state.workflow.eid): |
|
488 # entering or leaving a subworkflow |
|
489 if (subwfentries and |
|
490 subwfentries[-1].new_state.workflow.eid == trinfo.previous_state.workflow.eid): |
|
491 # leave |
|
492 del subwfentries[-1] |
|
493 else: |
|
494 # enter |
|
495 subwfentries.append(trinfo) |
|
496 if not subwfentries: |
|
497 return None |
|
498 return subwfentries[-1].transition |
479 |
499 |
480 def clear_all_caches(self): |
500 def clear_all_caches(self): |
481 super(WorkflowableMixIn, self).clear_all_caches() |
501 super(WorkflowableMixIn, self).clear_all_caches() |
482 clear_cache(self, 'cwetype_workflow') |
502 clear_cache(self, 'cwetype_workflow') |
483 |
503 |