Added quote_plus() and unquote_plus(), to do space/plus substitutions

for form field values.
Also corrected substitution example (the original changed the spelling
of "conolly" to "connolly" :).
This commit is contained in:
Guido van Rossum 1996-12-13 14:48:47 +00:00
parent 0564e12367
commit 8d40c843c1
2 changed files with 22 additions and 2 deletions

View File

@ -59,7 +59,12 @@ Letters, digits, and the characters ``\code{_,.-}'' are never quoted.
The optional \var{addsafe} parameter specifies additional characters
that should not be quoted --- its default value is \code{'/'}.
Example: \code{quote('/\~conolly/')} yields \code{'/\%7econnolly/'}.
Example: \code{quote('/\~connolly/')} yields \code{'/\%7econnolly/'}.
\end{funcdesc}
\begin{funcdesc}{quote_plus}{string\optional{\, addsafe}}
Like \code{quote()}, but also replaces spaces by plus signs, as
required for quoting HTML form values.
\end{funcdesc}
\begin{funcdesc}{unquote}{string}
@ -68,6 +73,11 @@ Replace \samp{\%xx} escapes by their single-character equivalent.
Example: \code{unquote('/\%7Econnolly/')} yields \code{'/\~connolly/'}.
\end{funcdesc}
\begin{funcdesc}{unquote_plus}{string}
Like \code{unquote()}, but also replaces plus signs by spaces, as
required for unquoting HTML form values.
\end{funcdesc}
Restrictions:
\begin{itemize}

View File

@ -59,7 +59,12 @@ Letters, digits, and the characters ``\code{_,.-}'' are never quoted.
The optional \var{addsafe} parameter specifies additional characters
that should not be quoted --- its default value is \code{'/'}.
Example: \code{quote('/\~conolly/')} yields \code{'/\%7econnolly/'}.
Example: \code{quote('/\~connolly/')} yields \code{'/\%7econnolly/'}.
\end{funcdesc}
\begin{funcdesc}{quote_plus}{string\optional{\, addsafe}}
Like \code{quote()}, but also replaces spaces by plus signs, as
required for quoting HTML form values.
\end{funcdesc}
\begin{funcdesc}{unquote}{string}
@ -68,6 +73,11 @@ Replace \samp{\%xx} escapes by their single-character equivalent.
Example: \code{unquote('/\%7Econnolly/')} yields \code{'/\~connolly/'}.
\end{funcdesc}
\begin{funcdesc}{unquote_plus}{string}
Like \code{unquote()}, but also replaces plus signs by spaces, as
required for unquoting HTML form values.
\end{funcdesc}
Restrictions:
\begin{itemize}