The response consist of a success indicator ("OK") followed by the response
body lenght. The response body is command-dependant.
raise CommandNotFoundError(command)
handler = getattr(handler, route[0])
route = route[1:]
- handler(*route)
+ return handler(*route)
if __name__ == '__main__':
def handle(self):
r"handle() -> None :: Handle incoming events using the dispatcher."
(msg, addr) = self.file.recvfrom(65535)
- self.dispatcher.dispatch(msg)
+ result = self.dispatcher.dispatch(msg)
+ if result is None:
+ msg = 'OK 0'
+ else:
+ msg = 'OK %d\n%s' % (len(str(result)), result)
+ self.file.sendto(msg, addr)
#try:
# d.dispatch(msg)
#except dis.BadRouteError, inst: