mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 23:31:56 +00:00
Rename make_eventhandler_response in TFWServer to increase readibility
This commit is contained in:
parent
986a67f5db
commit
d8988ea097
@ -23,7 +23,7 @@ class TFWServer:
|
||||
self._event_handler_connector = EventHandlerConnector()
|
||||
|
||||
self.application = Application(
|
||||
[(r'/ws', ZMQWebSocketProxy, {'make_eventhandler_response': self.make_eventhandler_response,
|
||||
[(r'/ws', ZMQWebSocketProxy, {'make_eventhandler_message': self.make_eventhandler_message,
|
||||
'proxy_filter': self.proxy_filter,
|
||||
'handle_trigger': self.handle_trigger,
|
||||
'event_handler_connector': self._event_handler_connector})]
|
||||
@ -38,7 +38,7 @@ class TFWServer:
|
||||
def fsm_manager(self):
|
||||
return self._fsm_manager
|
||||
|
||||
def make_eventhandler_response(self, message):
|
||||
def make_eventhandler_message(self, message):
|
||||
self.trigger_fsm(message)
|
||||
message['FSMUpdate'] = self._fsm_updater.get_fsm_state_and_transitions()
|
||||
return message
|
||||
|
@ -53,10 +53,10 @@ class ZMQWebSocketHandler(WebSocketHandler, ABC):
|
||||
def on_message(self, message):
|
||||
LOG.debug('Received on WebSocket: %s', message)
|
||||
if validate_message(message):
|
||||
self.send_message(self.make_eventhandler_response(message))
|
||||
self.send_message(self.make_eventhandler_message(message))
|
||||
|
||||
@abstractmethod
|
||||
def make_eventhandler_response(self, message):
|
||||
def make_eventhandler_message(self, message):
|
||||
raise NotImplementedError
|
||||
|
||||
def send_message(self, message: dict):
|
||||
@ -75,7 +75,7 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
|
||||
# pylint: disable=abstract-method
|
||||
def initialize(self, **kwargs): # pylint: disable=arguments-differ
|
||||
super(ZMQWebSocketProxy, self).initialize(**kwargs)
|
||||
self._make_eventhandler_response = kwargs['make_eventhandler_response']
|
||||
self._make_eventhandler_message = kwargs['make_eventhandler_message']
|
||||
self._proxy_filter = kwargs['proxy_filter']
|
||||
self._handle_trigger = kwargs['handle_trigger']
|
||||
|
||||
@ -84,8 +84,8 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
|
||||
if self._proxy_filter(message):
|
||||
super().on_message(message)
|
||||
|
||||
def make_eventhandler_response(self, message):
|
||||
return self._make_eventhandler_response(message)
|
||||
def make_eventhandler_message(self, message):
|
||||
return self._make_eventhandler_message(message)
|
||||
|
||||
def handle_trigger(self, message):
|
||||
self._handle_trigger(message)
|
||||
|
Loading…
Reference in New Issue
Block a user