From 55a530448b4107edcb3bb8543b562c7208080995 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 16 Mar 2007 20:26:11 +0000 Subject: Merged revisions 496593 via svnmerge from https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9 ........ r496593 | rhs | 2007-01-16 00:28:25 -0500 (Tue, 16 Jan 2007) | 1 line 0-9 request/response framing for python ........ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@519129 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/delegate.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'python/qpid/delegate.py') diff --git a/python/qpid/delegate.py b/python/qpid/delegate.py index 035bb3c476..90e5c1edc8 100644 --- a/python/qpid/delegate.py +++ b/python/qpid/delegate.py @@ -22,33 +22,25 @@ Delegate implementation intended for use with the peer module. """ import threading, inspect -from spec import pythonize +from connection import Method, Request, Response class Delegate: def __init__(self): self.handlers = {} self.invokers = {} - # initialize all the mixins - self.invoke_all("init") - def invoke_all(self, meth, *args, **kwargs): - for cls in inspect.getmro(self.__class__): - if hasattr(cls, meth): - getattr(cls, meth)(self, *args, **kwargs) - - def dispatch(self, channel, message): - method = message.method + def __call__(self, channel, frame): + method = frame.method try: handler = self.handlers[method] except KeyError: - name = "%s_%s" % (pythonize(method.klass.name), - pythonize(method.name)) + name = "%s_%s" % (method.klass.name, method.name) handler = getattr(self, name) self.handlers[method] = handler - return handler(channel, message) + return handler(channel, frame) def close(self, reason): - self.invoke_all("close", reason) + print "Connection closed: %s" % reason -- cgit v1.2.1