[docs] [issue23040] Better documentation for the urlencode safe parameter
Wojtek Ruszczewski
report at bugs.python.org
Fri Dec 12 18:30:20 CET 2014
Wojtek Ruszczewski added the comment:
I was looking at the sentence:
"When query parameter is a str, the safe, encoding and error parameters are passed down to quote_plus() for encoding."
The query argument can't be a string itself (gives a TypeError with 3.5a0 and I think it's only intended to accept dicts or sequences of 2-tuples). The "parameter" then must refer to a component of the query -- a key or a value.
The safe argument is passed down and is effective no matter if a component is of str or bytes type (or a sequence with doseq), for example:
>>> urlencode({b'/ n': ''}, safe='/')
'/+n='
(note the "b"; without "safe" the slash would get encoded as %2F).
Maybe it would also be good to change "query parameter" to "query component" in that sentence.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23040>
_______________________________________
More information about the docs
mailing list