Rename make_response in networking to avoid confusion

This commit is contained in:
Kristóf Tóth 2018-04-13 16:16:51 +02:00
parent d04479157d
commit 18e9ee5f52
2 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ class TFWServer:
self._event_handler_connector = EventHandlerConnector()
self.application = Application(
[(r'/ws', ZMQWebSocketProxy, {'make_response': self.make_response,
[(r'/ws', ZMQWebSocketProxy, {'make_eventhandler_response': self.make_eventhandler_response,
'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_response(self, message):
def make_eventhandler_response(self, message):
self.trigger_fsm(message)
message['FSMUpdate'] = self._fsm_updater.get_fsm_state_and_transitions()
return message

View File

@ -49,10 +49,10 @@ class ZMQWebSocketHandler(WebSocketHandler, ABC):
def on_message(self, message):
LOG.debug('Received on WebSocket: %s', message)
self.send_message(self.make_response(message))
self.send_message(self.make_eventhandler_response(message))
@abstractmethod
def make_response(self, message):
def make_eventhandler_response(self, message):
raise NotImplementedError
def send_message(self, message: dict, key: str = None):
@ -71,7 +71,7 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
# pylint: disable=abstract-method
def initialize(self, **kwargs): # pylint: disable=arguments-differ
super(ZMQWebSocketProxy, self).initialize(**kwargs)
self._make_response = kwargs['make_response']
self._make_eventhandler_response = kwargs['make_eventhandler_response']
self._proxy_filter = kwargs['proxy_filter']
self._handle_trigger = kwargs['handle_trigger']
@ -80,8 +80,8 @@ class ZMQWebSocketProxy(ZMQWebSocketHandler):
if self._proxy_filter(message):
super().on_message(message)
def make_response(self, message):
return self._make_response(message)
def make_eventhandler_response(self, message):
return self._make_eventhandler_response(message)
def handle_trigger(self, message):
self._handle_trigger(message)