From 23bef68f51f04553a471144a5c3ffbdcd749a8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Bokros?= Date: Sun, 3 Dec 2017 18:52:22 +0100 Subject: [PATCH] Remove passing self to handler functions in EventHandler --- src/event_handlers/event_handler.py | 2 +- src/event_handlers/event_handler_example.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/event_handlers/event_handler.py b/src/event_handlers/event_handler.py index 8db5d64..b7f16cc 100644 --- a/src/event_handlers/event_handler.py +++ b/src/event_handlers/event_handler.py @@ -11,7 +11,7 @@ class EventHandler(EventHandlerBase): def event_handler_callback(msg_parts): anchor, message = msg_parts data_json = json.loads(message) - response = self.event_handler_function(data_json, self) + response = self.event_handler_function(data_json) encoded_response = json.dumps(response).encode('utf-8') self.zmq_push_socket.send_multipart([anchor, encoded_response]) diff --git a/src/event_handlers/event_handler_example.py b/src/event_handlers/event_handler_example.py index a65fc14..3875054 100644 --- a/src/event_handlers/event_handler_example.py +++ b/src/event_handlers/event_handler_example.py @@ -13,17 +13,17 @@ def echo_handler(data): return data -def rot13_handler(data, *args): +def rot13_handler(data): data['data'] = codecs.encode(data['data'], 'rot13') return data -def change_case_handler(data, *args): +def change_case_handler(data): data['data'] = data['data'].upper() if data['data'].islower() else data['data'].lower() return data -def reverse_handler(data, *args): +def reverse_handler(data): data['data'] = data['data'][::-1] return data