From 8fab3d22262257a7675d9eac1f93a35bf2b27564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Tue, 24 Jul 2018 17:17:14 +0200 Subject: [PATCH] Conform new fsm_update API --- controller/opt/server.py | 2 +- solvable/src/event_handler_main.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/controller/opt/server.py b/controller/opt/server.py index 82a3811..8155726 100644 --- a/controller/opt/server.py +++ b/controller/opt/server.py @@ -15,7 +15,7 @@ class ControllerPostHandler(RequestHandler): def post(self, *args, **kwargs): self.set_header('Content-Type', 'application/json') self.write(json.dumps({ - 'solved': self.controller.in_accepted_state + 'solved': self.controller.fsm_in_accepted_state })) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 9ff99e5..36a8902 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -86,14 +86,15 @@ class MessageFSMStepsEventHandler(FSMAwareEventHandler): def handle_event(self, message): pass - def handle_fsm_step(self, from_state, to_state, trigger): + def handle_fsm_step(self, **kwargs): """ When the FSM steps this method is invoked. + Receives a 'data' field from an fsm_update message as kwargs. """ MessageSender().send( 'FSM info', - f'FSM has stepped from state "{from_state}" ' - f'to state "{to_state}" in response to trigger "{trigger}"' + f'FSM has stepped from state "{kwargs["last_event"]["from_state"]}" ' + f'to state "{kwargs["current_state"]}" in response to trigger "{kwargs["last_event"]["trigger"]}"' )