diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-07-13 17:58:44 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-07-13 17:58:44 +0000 |
commit | e26d7c17afc51e5afccbe4114f62e5d5cd030256 (patch) | |
tree | 2bbe1162a27504dd35524483b21ada49e609a578 /python/qpid/util.py | |
parent | b34fe9f8bf9bf60a471506df49b73ff8190355aa (diff) | |
download | qpid-python-e26d7c17afc51e5afccbe4114f62e5d5cd030256.tar.gz |
fixed missign import and added test case for reconnect_urls
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@963803 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/util.py')
-rw-r--r-- | python/qpid/util.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/python/qpid/util.py b/python/qpid/util.py index 3409d777f9..e62bebdf24 100644 --- a/python/qpid/util.py +++ b/python/qpid/util.py @@ -109,14 +109,21 @@ class URL: AMQP = "amqp" def __init__(self, s): - match = URL.RE.match(s) - if match is None: - raise ValueError(s) - self.scheme, self.user, self.password, self.host, port = match.groups() - if port is None: - self.port = None + if isinstance(s, URL): + self.scheme = s.scheme + self.user = s.user + self.password = s.password + self.host = s.host + self.port = s.port else: - self.port = int(port) + match = URL.RE.match(s) + if match is None: + raise ValueError(s) + self.scheme, self.user, self.password, self.host, port = match.groups() + if port is None: + self.port = None + else: + self.port = int(port) def __repr__(self): return "URL(%r)" % str(self) |