mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-09-08 20:14:09 +00:00
Remove passing self to handler functions in EventHandler
This commit is contained in:
parent
3164a760a1
commit
23bef68f51
@ -11,7 +11,7 @@ class EventHandler(EventHandlerBase):
|
|||||||
def event_handler_callback(msg_parts):
|
def event_handler_callback(msg_parts):
|
||||||
anchor, message = msg_parts
|
anchor, message = msg_parts
|
||||||
data_json = json.loads(message)
|
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')
|
encoded_response = json.dumps(response).encode('utf-8')
|
||||||
self.zmq_push_socket.send_multipart([anchor, encoded_response])
|
self.zmq_push_socket.send_multipart([anchor, encoded_response])
|
||||||
|
|
||||||
|
@ -13,17 +13,17 @@ def echo_handler(data):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def rot13_handler(data, *args):
|
def rot13_handler(data):
|
||||||
data['data'] = codecs.encode(data['data'], 'rot13')
|
data['data'] = codecs.encode(data['data'], 'rot13')
|
||||||
return data
|
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()
|
data['data'] = data['data'].upper() if data['data'].islower() else data['data'].lower()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def reverse_handler(data, *args):
|
def reverse_handler(data):
|
||||||
data['data'] = data['data'][::-1]
|
data['data'] = data['data'][::-1]
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user