diff options
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r-- | Lib/urlparse.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index 9c9af45..8cc7a97 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -220,16 +220,18 @@ def urlsplit(url, scheme='', allow_fragments=True): _parse_cache[key] = v return v -def urlunparse((scheme, netloc, url, params, query, fragment)): +def urlunparse(components): """Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).""" + scheme, netloc, url, params, query, fragment = components if params: url = "%s;%s" % (url, params) return urlunsplit((scheme, netloc, url, query, fragment)) -def urlunsplit((scheme, netloc, url, query, fragment)): +def urlunsplit(components): + scheme, netloc, url, query, fragment = components if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url |