summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNuno Santos <nsantos@apache.org>2008-05-13 20:36:23 +0000
committerNuno Santos <nsantos@apache.org>2008-05-13 20:36:23 +0000
commit715b3ab46cf6f0f8b3e16c492c62e0af418e11f4 (patch)
treec88b45b3adc8e31a594a5cf6209820f25cba828e /python
parenta541665a2ea11635c16b06c6730aafc70d3ddae4 (diff)
downloadqpid-python-715b3ab46cf6f0f8b3e16c492c62e0af418e11f4.tar.gz
continuation of QPID-1052
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@656004 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/management.py18
-rw-r--r--python/qpid/managementdata.py2
-rw-r--r--python/tests_0-10/management.py2
3 files changed, 14 insertions, 8 deletions
diff --git a/python/qpid/management.py b/python/qpid/management.py
index fe980b4a02..f831ee472e 100644
--- a/python/qpid/management.py
+++ b/python/qpid/management.py
@@ -78,6 +78,13 @@ class methodResult:
for arg in args:
setattr (self, arg, args[arg])
+class brokerInfo:
+ """ Object that contains information about a broker and the session to it """
+
+ def __init__ (self, brokerId, sessionId):
+ self.brokerId = brokerId
+ self.sessionId = sessionId
+
class managementChannel:
""" This class represents a connection to an AMQP broker. """
@@ -137,7 +144,7 @@ class managementChannel:
def exceptionCb (self, data):
if self.ecb != None:
- self.ecb (data)
+ self.ecb (self, data)
def send (self, exchange, msg):
if self.enabled:
@@ -323,9 +330,9 @@ class managementClient:
self.parse (ch, codec, hdr[0], hdr[1])
ch.accept(msg)
- def exceptCb (self, data):
+ def exceptCb (self, ch, data):
if self.closeCb != None:
- self.closeCb (data)
+ self.closeCb (ch.context, data)
#========================================================
# Internal Functions
@@ -498,10 +505,9 @@ class managementClient:
def handleBrokerResponse (self, ch, codec):
uuid = codec.read_uuid ()
- data = (uuid, ch.sessionId)
- ch.setBrokerInfo (data)
+ ch.brokerInfo = brokerInfo (uuid, ch.sessionId)
if self.ctrlCb != None:
- self.ctrlCb (ch.context, self.CTRL_BROKER_INFO, data)
+ self.ctrlCb (ch.context, self.CTRL_BROKER_INFO, ch.brokerInfo)
# Send a package request
sendCodec = Codec (self.spec)
diff --git a/python/qpid/managementdata.py b/python/qpid/managementdata.py
index bdc299767d..36eb442e0d 100644
--- a/python/qpid/managementdata.py
+++ b/python/qpid/managementdata.py
@@ -160,7 +160,7 @@ class ManagementData:
finally:
self.lock.release ()
- def closeHandler (self, reason):
+ def closeHandler (self, context, reason):
print "Connection to broker lost:", reason
self.operational = False
if self.cli != None:
diff --git a/python/tests_0-10/management.py b/python/tests_0-10/management.py
index 3ca7284d2a..f1360a1902 100644
--- a/python/tests_0-10/management.py
+++ b/python/tests_0-10/management.py
@@ -73,7 +73,7 @@ class ManagementTest (TestBase010):
brokerSessions = mc.syncGetObjects (mch, "session")
found = False
for bs in brokerSessions:
- if bs.name == info[1]:
+ if bs.name == info.sessionId:
found = True
self.assertEqual (found, True)
mc.removeChannel (mch)