From d8988ea097d411afec3a3cf2deea66c6dd2c1036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 16 Apr 2018 12:57:08 +0200 Subject: [PATCH] Rename make_eventhandler_response in TFWServer to increase readibility --- lib/tfw/networking/server/tfw_server.py | 4 ++-- lib/tfw/networking/server/zmq_websocket_handler.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/tfw/networking/server/tfw_server.py b/lib/tfw/networking/server/tfw_server.py index b573533..a39b33e 100644 --- a/lib/tfw/networking/server/tfw_server.py +++ b/lib/tfw/networking/server/tfw_server.py @@ -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 diff --git a/lib/tfw/networking/server/zmq_websocket_handler.py b/lib/tfw/networking/server/zmq_websocket_handler.py index fee2ff1..c842205 100644 --- a/lib/tfw/networking/server/zmq_websocket_handler.py +++ b/lib/tfw/networking/server/zmq_websocket_handler.py @@ -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)