def dispatch(self, call): """ Dispatch the call to the handler. :param call: A *call* document. :type call: Document """ reply = Document() try: method = getattr(self.handler, call.name) result = method(*call.args, **call.kwargs) reply.code = 0 reply.result = result except Exception, e: reply.code = 1 reply.result = utf8(e)
def __call__(self, *args, **kwargs): try: result = self.call(*args, **kwargs) except Exception, e: reply = Document() reply.code = 1 reply.result = utf8(e) result = reply
def __call__(self, *args, **kwargs): try: result = self.call(*args, **kwargs) except Exception as e: reply = Document() reply.code = 1 reply.result = str(e) result = reply return result