1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 03:27:18 +00:00

Conform new fsm_update API

This commit is contained in:
Kristóf Tóth 2018-07-24 17:17:14 +02:00
parent b15e442039
commit 8fab3d2226
2 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,7 @@ class ControllerPostHandler(RequestHandler):
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
self.set_header('Content-Type', 'application/json') self.set_header('Content-Type', 'application/json')
self.write(json.dumps({ self.write(json.dumps({
'solved': self.controller.in_accepted_state 'solved': self.controller.fsm_in_accepted_state
})) }))

View File

@ -86,14 +86,15 @@ class MessageFSMStepsEventHandler(FSMAwareEventHandler):
def handle_event(self, message): def handle_event(self, message):
pass 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. When the FSM steps this method is invoked.
Receives a 'data' field from an fsm_update message as kwargs.
""" """
MessageSender().send( MessageSender().send(
'FSM info', 'FSM info',
f'FSM has stepped from state "{from_state}" ' f'FSM has stepped from state "{kwargs["last_event"]["from_state"]}" '
f'to state "{to_state}" in response to trigger "{trigger}"' f'to state "{kwargs["current_state"]}" in response to trigger "{kwargs["last_event"]["trigger"]}"'
) )