Make FSM triggering dependent on FSMManager

This commit is contained in:
Kristóf Tóth 2018-02-26 15:08:29 +01:00
parent 50c940b21d
commit 7e8ea0c7ac

View File

@ -12,6 +12,7 @@ class TFWServer:
def __init__(self, fsm_type):
self._fsm = fsm_type()
self.fsm_updater = FSMUpdater(self._fsm)
self.fsm_manager = FSMManager(self._fsm)
self._fsm.subscribe(self.fsm_updater.update)
self.application = Application(
@ -26,7 +27,7 @@ class TFWServer:
def make_response(self, message):
trigger = message.get('trigger', '')
try: self.fsm.trigger(trigger, message=message)
try: self.fsm_manager.trigger(trigger, message)
except AttributeError: log.debug('FSM failed to execute nonexistent trigger: "{}"'.format(trigger))
return message