mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 00:11:33 +00:00
Implement trigger history in FSMBase
This commit is contained in:
parent
d98ce58651
commit
77f14df17b
@ -24,6 +24,7 @@ class FSMBase(Machine, CallbackMixin):
|
|||||||
def __init__(self, initial=None, accepted_states=None):
|
def __init__(self, initial=None, accepted_states=None):
|
||||||
self.accepted_states = accepted_states or [self.states[-1]]
|
self.accepted_states = accepted_states or [self.states[-1]]
|
||||||
self.trigger_predicates = defaultdict(list)
|
self.trigger_predicates = defaultdict(list)
|
||||||
|
self.trigger_history = []
|
||||||
|
|
||||||
Machine.__init__(
|
Machine.__init__(
|
||||||
self,
|
self,
|
||||||
@ -61,5 +62,6 @@ class FSMBase(Machine, CallbackMixin):
|
|||||||
if all(predicate_results):
|
if all(predicate_results):
|
||||||
try:
|
try:
|
||||||
self.trigger(trigger)
|
self.trigger(trigger)
|
||||||
|
self.trigger_history.append(trigger)
|
||||||
except (AttributeError, MachineError):
|
except (AttributeError, MachineError):
|
||||||
LOG.debug('FSM failed to execute nonexistent trigger: "%s"', trigger)
|
LOG.debug('FSM failed to execute nonexistent trigger: "%s"', trigger)
|
||||||
|
Loading…
Reference in New Issue
Block a user