summaryrefslogtreecommitdiff
path: root/python/qpid/delegate.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-03-16 20:26:11 +0000
committerAlan Conway <aconway@apache.org>2007-03-16 20:26:11 +0000
commit55a530448b4107edcb3bb8543b562c7208080995 (patch)
tree23be2798e546f641ff4652f7255c090a39cd3010 /python/qpid/delegate.py
parentf3cb9466b4b969747f97ab6716964179db96f124 (diff)
downloadqpid-python-55a530448b4107edcb3bb8543b562c7208080995.tar.gz
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
Diffstat (limited to 'python/qpid/delegate.py')
-rw-r--r--python/qpid/delegate.py20
1 files changed, 6 insertions, 14 deletions
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