Joshua Johnston added the comment:
If this was a function to encode a dict into something then I would see your
point and agree. urlencode is specifically designed to work within the domain
or URIs. In this domain, it is acceptable to have an empty value for a key in a
query string. None is a representation of nothing, empty, null, the absence of
a value. Therefore you would expect a function in the domain of URIs to
construct a valid URI component when you specifically tell it to use None.
Valid is up to you, either ignore the key-value pair completely, or use key[=&]
to represent the empty value.
Take Requests as an example that gets it right:
>>> import requests
>>> requests.get('http://www.google.com/', params={'key': None}).url
u'http://www.google.com/'
>>> requests.get('http://www.google.com/', params={'key': ''}).url
u'http://www.google.com/?key='
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com