summaryrefslogtreecommitdiff
path: root/python/qpid/connection.py
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-05-09 11:15:35 +0000
committerGordon Sim <gsim@apache.org>2008-05-09 11:15:35 +0000
commit539672f9fa39dd22bb68fc50c22608aec2bdfe22 (patch)
tree5c78311f958e5bc45d90d02cb61c3274a0de651b /python/qpid/connection.py
parent53428ae6d4d2705a5df7eda2d43fdfbc92da3670 (diff)
downloadqpid-python-539672f9fa39dd22bb68fc50c22608aec2bdfe22.tar.gz
Enabled PLAIN authentication and setting of username and password for 0-10 python client.
Added options to all command line tools to allow a username and password to be specified. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@654759 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/connection.py')
-rw-r--r--python/qpid/connection.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/qpid/connection.py b/python/qpid/connection.py
index 39f882e9c3..4ed430249b 100644
--- a/python/qpid/connection.py
+++ b/python/qpid/connection.py
@@ -37,6 +37,8 @@ class ChannelsBusy(Exception): pass
class SessionBusy(Exception): pass
+class ConnectionFailed(Exception): pass
+
def client(*args):
return delegates.Client(*args)
@@ -45,7 +47,7 @@ def server(*args):
class Connection(Assembler):
- def __init__(self, sock, spec=None, delegate=client):
+ def __init__(self, sock, spec=None, delegate=client, **args):
Assembler.__init__(self, sock)
if spec == None:
spec = load(default())
@@ -58,13 +60,14 @@ class Connection(Assembler):
self.condition = Condition()
self.opened = False
+ self.failed = False
self.thread = Thread(target=self.run)
self.thread.setDaemon(True)
self.channel_max = 65535
- self.delegate = delegate(self)
+ self.delegate = delegate(self, args)
def attach(self, name, ch, delegate, force=False):
self.lock.acquire()
@@ -127,8 +130,10 @@ class Connection(Assembler):
def start(self, timeout=None):
self.delegate.start()
self.thread.start()
- if not wait(self.condition, lambda: self.opened, timeout):
+ if not wait(self.condition, lambda: self.opened or self.failed, timeout):
raise Timeout()
+ if (self.failed):
+ raise ConnectionFailed()
def run(self):
# XXX: we don't really have a good way to exit this loop without