mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 14:01:32 +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._event_handler_connector = EventHandlerConnector()
|
||||||
|
|
||||||
self.application = Application(
|
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,
|
'proxy_filter': self.proxy_filter,
|
||||||
'handle_trigger': self.handle_trigger,
|
'handle_trigger': self.handle_trigger,
|
||||||
'event_handler_connector': self._event_handler_connector})]
|
'event_handler_connector': self._event_handler_connector})]
|
||||||
@ -38,7 +38,7 @@ class TFWServer:
|
|||||||
def fsm_manager(self):
|
def fsm_manager(self):
|
||||||
return self._fsm_manager
|
return self._fsm_manager
|
||||||
|
|
||||||
def make_eventhandler_response(self, message):
|
def make_eventhandler_message(self, message):
|
||||||
self.trigger_fsm(message)
|
self.trigger_fsm(message)
|
||||||
message['FSMUpdate'] = self._fsm_updater.get_fsm_state_and_transitions()
|
message['FSMUpdate'] = self._fsm_updater.get_fsm_state_and_transitions()
|
||||||
return message
|
return message
|
||||||
|
@ -53,10 +53,10 @@ class ZMQWebSocketHandler(WebSocketHandler, ABC):
|
|||||||
def on_message(self, message):
|
def on_message(self, message):
|
||||||
LOG.debug('Received on WebSocket: %s', message)
|
LOG.debug('Received on WebSocket: %s', message)
|
||||||
if validate_message(message):
|
if validate_message(message):
|
||||||
self.send_message(self.make_eventhandler_response(message))
|
self.send_message(self.make_eventhandler_message(message))
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def make_eventhandler_response(self, message):
|
def make_eventhandler_message(self, message):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def send_message(self, message: dict):
|
def send_message(self, message: dict):
|
||||||
@ -75,7 +75,7 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
|
|||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
def initialize(self, **kwargs): # pylint: disable=arguments-differ
|
def initialize(self, **kwargs): # pylint: disable=arguments-differ
|
||||||
super(ZMQWebSocketProxy, self).initialize(**kwargs)
|
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._proxy_filter = kwargs['proxy_filter']
|
||||||
self._handle_trigger = kwargs['handle_trigger']
|
self._handle_trigger = kwargs['handle_trigger']
|
||||||
|
|
||||||
@ -84,8 +84,8 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
|
|||||||
if self._proxy_filter(message):
|
if self._proxy_filter(message):
|
||||||
super().on_message(message)
|
super().on_message(message)
|
||||||
|
|
||||||
def make_eventhandler_response(self, message):
|
def make_eventhandler_message(self, message):
|
||||||
return self._make_eventhandler_response(message)
|
return self._make_eventhandler_message(message)
|
||||||
|
|
||||||
def handle_trigger(self, message):
|
def handle_trigger(self, message):
|
||||||
self._handle_trigger(message)
|
self._handle_trigger(message)
|
||||||
|
Loading…
Reference in New Issue
Block a user