[gen] Wrapper.getLastEvent: parameter 'not before' can also hold a list of transitions.
This commit is contained in:
parent
7821280d35
commit
1d721d61f4
|
@ -1128,13 +1128,19 @@ class AbstractWrapper(object):
|
||||||
a list of names: in this case, it returns the most recent occurrence
|
a list of names: in this case, it returns the most recent occurrence
|
||||||
of those transitions. If p_notBefore is given, it corresponds to a
|
of those transitions. If p_notBefore is given, it corresponds to a
|
||||||
kind of start transition for the search: we will not search in the
|
kind of start transition for the search: we will not search in the
|
||||||
history preceding the last occurrence of this transition.'''
|
history preceding the last occurrence of this transition. Note that
|
||||||
|
p_notBefore can hold a list of transitions.'''
|
||||||
history = history or self.history
|
history = history or self.history
|
||||||
i = len(history) - 1
|
i = len(history) - 1
|
||||||
while i >= 0:
|
while i >= 0:
|
||||||
event = history[i]
|
event = history[i]
|
||||||
if notBefore and (event['action'] == notBefore): return
|
if notBefore:
|
||||||
if isinstance(transition, basestring):
|
if isinstance(notBefore, str):
|
||||||
|
condition = event['action'] == notBefore
|
||||||
|
else:
|
||||||
|
condition = event['action'] in notBefore
|
||||||
|
if condition: return
|
||||||
|
if isinstance(transition, str):
|
||||||
condition = event['action'] == transition
|
condition = event['action'] == transition
|
||||||
else:
|
else:
|
||||||
condition = event['action'] in transition
|
condition = event['action'] in transition
|
||||||
|
|
Loading…
Reference in a new issue