Ejemplo n.º 1
0
 def handler(raw_msg):
     if 'result' in raw_msg:
         op = ResponseMessage.create(raw_msg)
     else:
         op = invocation_message(raw_msg)
     if op or not self.ignore_invalid_messages:
         callback(op)
     else:
         if callable(self.on_bad_message):
             self.on_bad_message(raw_msg)
         else:
             print "Bad Message", repr(raw_msg)
Ejemplo n.º 2
0
 def handler(raw_msg):
     if 'result' in raw_msg:
         op = ResponseMessage.create(raw_msg)
     else:
         op = invocation_message(raw_msg)
     if op or not self.ignore_invalid_messages:
         callback(op)
     else:
         if callable(self.on_bad_message):
             self.on_bad_message(raw_msg)
         else:
             print "Bad Message", repr(raw_msg)
Ejemplo n.º 3
0
 def write_response(self, command, callback):
     "Sends a given command back as a response."
     if not callable(getattr(command, "to_network", None)):
         command = ResponseMessage.create(command)
     self.stream.write(command, callback=callback)
     print "mediator <-", command
Ejemplo n.º 4
0
 def write_response(self, command, callback):
     "Sends a given command back as a response."
     if not callable(getattr(command, 'to_network', None)):
         command = ResponseMessage.create(command)
     self.stream.write(command, callback=callback)
     print "mediator <-", command