mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 02:11:31 +00:00
Add message argument to FSMManager.trigger()
This commit is contained in:
parent
47a4e078de
commit
25fd71a2b8
@ -42,9 +42,9 @@ class FSMManager:
|
|||||||
self.fsm = fsm_type()
|
self.fsm = fsm_type()
|
||||||
self.trigger_handlers = defaultdict(list)
|
self.trigger_handlers = defaultdict(list)
|
||||||
|
|
||||||
def trigger(self, trigger):
|
def trigger(self, trigger, message):
|
||||||
if all((handler() for handler in self.trigger_handlers[trigger])):
|
if all((handler() for handler in self.trigger_handlers[trigger])):
|
||||||
try: self.fsm.trigger(trigger, message='')
|
try: self.fsm.trigger(trigger, message=message)
|
||||||
except AttributeError: log.debug('FSM failed to execute nonexistent trigger: "{}"'.format(trigger))
|
except AttributeError: log.debug('FSM failed to execute nonexistent trigger: "{}"'.format(trigger))
|
||||||
|
|
||||||
def subscribe_handler(self, trigger, handler):
|
def subscribe_handler(self, trigger, handler):
|
||||||
|
Loading…
Reference in New Issue
Block a user