diff options
author | Georg Brandl <georg@python.org> | 2006-10-12 11:14:44 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-10-12 11:14:44 +0000 |
commit | b85509d5ef5acbe5959383a1007335ad5b7aa786 (patch) | |
tree | a4d9b926352f81698ce40ffd51172e4568e850bd | |
parent | 3c48709e3a6bc78bf2777b6b202eff0b2c323b89 (diff) | |
download | cpython-git-b85509d5ef5acbe5959383a1007335ad5b7aa786.tar.gz |
Bug #1546628: add a note about urlparse.urljoin() and absolute paths.
(backport from rev. 52303)
-rw-r--r-- | Doc/lib/liburlparse.tex | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Doc/lib/liburlparse.tex b/Doc/lib/liburlparse.tex index f18efe9cf6..86036056e9 100644 --- a/Doc/lib/liburlparse.tex +++ b/Doc/lib/liburlparse.tex @@ -142,7 +142,7 @@ a ? with an empty query; the RFC states that these are equivalent). \begin{funcdesc}{urljoin}{base, url\optional{, allow_fragments}} Construct a full (``absolute'') URL by combining a ``base URL'' -(\var{base}) with a ``relative URL'' (\var{url}). Informally, this +(\var{base}) with another URL (\var{url}). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide missing components in the relative URL. For example: @@ -155,6 +155,20 @@ components in the relative URL. For example: The \var{allow_fragments} argument has the same meaning and default as for \function{urlparse()}. + +\note{If \var{url} is an absolute URL (that is, starting with \code{//} + or \code{scheme://}, the \var{url}'s host name and/or scheme + will be present in the result. For example:} + +\begin{verbatim} +>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', +... '//www.python.org/%7Eguido') +'http://www.python.org/%7Eguido' +\end{verbatim} + +If you do not want that behavior, preprocess +the \var{url} with \function{urlsplit()} and \function{urlunsplit()}, +removing possible \em{scheme} and \em{netloc} parts. \end{funcdesc} \begin{funcdesc}{urldefrag}{url} |