From 77f14df17bdecdda088bb63f35743547095887df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sat, 14 Jul 2018 20:44:31 +0200 Subject: [PATCH] Implement trigger history in FSMBase --- lib/tfw/fsm_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tfw/fsm_base.py b/lib/tfw/fsm_base.py index 28b5ef6..2de2b43 100644 --- a/lib/tfw/fsm_base.py +++ b/lib/tfw/fsm_base.py @@ -24,6 +24,7 @@ class FSMBase(Machine, CallbackMixin): def __init__(self, initial=None, accepted_states=None): self.accepted_states = accepted_states or [self.states[-1]] self.trigger_predicates = defaultdict(list) + self.trigger_history = [] Machine.__init__( self, @@ -61,5 +62,6 @@ class FSMBase(Machine, CallbackMixin): if all(predicate_results): try: self.trigger(trigger) + self.trigger_history.append(trigger) except (AttributeError, MachineError): LOG.debug('FSM failed to execute nonexistent trigger: "%s"', trigger)