summaryrefslogtreecommitdiff
path: root/python/qpid/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/qpid/util.py')
-rw-r--r--python/qpid/util.py21
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)