Fix Issue8653 - Docstring for urlunsplit function.

This commit is contained in:
Senthil Kumaran 2010-06-28 13:56:46 +00:00
parent 2af7e6d2d9
commit 5871a8d744
1 changed files with 5 additions and 0 deletions

View File

@ -217,6 +217,11 @@ def urlunparse(data):
return urlunsplit((scheme, netloc, url, query, fragment)) return urlunsplit((scheme, netloc, url, query, fragment))
def urlunsplit(data): def urlunsplit(data):
"""Combine the elements of a tuple as returned by urlsplit() into a
complete URL as a string. The data argument can be any five-item iterable.
This may result in a slightly different, but equivalent URL, if the URL that
was parsed originally had unnecessary delimiters (for example, a ? with an
empty query; the RFC states that these are equivalent)."""
scheme, netloc, url, query, fragment = data scheme, netloc, url, query, fragment = data
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
if url and url[:1] != '/': url = '/' + url if url and url[:1] != '/': url = '/' + url