better way for dealing with relative paths

This commit is contained in:
Miroslav Stampar
2011-05-24 05:26:51 +00:00
parent a536bf210f
commit ad25bcc2be
2 changed files with 4 additions and 1 deletions

View File

@@ -104,6 +104,9 @@ class Connect:
retrying = kwargs.get('retrying', False)
redirecting = kwargs.get('redirecting', False)
if not urlparse.urlsplit(url).netloc:
url = urlparse.urljoin(conf.url, url)
# flag to know if we are dealing with the same target host
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))