summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 21:42:13 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 21:42:13 (GMT)
commit80deebb51e676140763f0992e6d85771c874a7e8 (patch)
tree92cbae2a2eaddb7662984999fe901e8ab82cbdce
parenta96379678137e207e27d90fb61ea67e74e1ae962 (diff)
Url: simplify
-rw-r--r--src/login.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/login.py b/src/login.py
index 5c17579..15a558d 100644
--- a/src/login.py
+++ b/src/login.py
@@ -63,20 +63,15 @@ class Url(unicode):
# pylint: disable=too-many-public-methods
# TODO: base content: host:port
def __new__(cls, url):
+ assert url
host = None
port = None
- if url:
- urlParts = url.split(':')
- host = urlParts[0]
- if english(host) == Query.localServerName:
- host = '127.0.0.1'
- if len(urlParts) > 1:
- port = int(urlParts[1])
- else:
- # TODO: but host is None, do we ever get here?
- url = host
- if port:
- url += ':{}'.format(port)
+ urlParts = url.split(':')
+ host = urlParts[0]
+ if english(host) == Query.localServerName:
+ host = '127.0.0.1'
+ if len(urlParts) > 1:
+ port = int(urlParts[1])
obj = unicode.__new__(cls, url)
obj.host = host
obj.port = port