mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 11:21:32 +00:00
Fix EventHandlerBase.event_handler_callback broken logic
This commit is contained in:
parent
9d93d055b8
commit
db1b008fc9
@ -23,17 +23,20 @@ class EventHandlerBase(ABC):
|
||||
def event_handler_callback(self, msg_parts):
|
||||
"""
|
||||
Callback that is invoked when receiving a message.
|
||||
Dispatches messages to handler methods and sends
|
||||
a response back in case the handler returned something.
|
||||
This is subscribed in __init__().
|
||||
"""
|
||||
# TODO: fix faulty logic below
|
||||
message = deserialize_tfw_msg(*msg_parts)
|
||||
response = self.dispatch_handling(message)
|
||||
response['key'] = message['key']
|
||||
if response is None:
|
||||
return
|
||||
self.server_connector.send(response)
|
||||
if response:
|
||||
response['key'] = message['key']
|
||||
self.server_connector.send(response)
|
||||
|
||||
def dispatch_handling(self, message):
|
||||
"""
|
||||
Used to dispatch messages to their specific handlers.
|
||||
"""
|
||||
if message['key'] != 'reset':
|
||||
return self.handle_event(message)
|
||||
return self.handle_reset(message)
|
||||
@ -50,7 +53,7 @@ class EventHandlerBase(ABC):
|
||||
def handle_reset(self, message):
|
||||
# pylint: disable=unused-argument,no-self-use
|
||||
"""
|
||||
'reset' events usually receive some sort of special treatment.
|
||||
Usually 'reset' events receive some sort of special treatment.
|
||||
|
||||
:param message: the message received
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user