[issue18857] urlencode of a None value uses the string 'None'

Senthil Kumaran report at bugs.python.org
Mon Sep 16 00:36:50 CEST 2013


Senthil Kumaran added the comment:

The patch looks good, but I have doubt in the claim that, this new behavior is actually a right thing to do.

RDM wrote:

Now, that said, it seems to me that while it is not (apparently) RFC compliant, query strings do have a natural way to support null values: a name without a value.  It would therefore be convenient if urlencode supported null values by turning something like {'josh': None, 'fred': 'abc'} into:

    josh&fred=abc


It is correctly recognized that it is not RFC Compliant. A reference to this behavior exhibited by the software may be helpful. The `application/x-www-form-urlencoded` type always looks for key=value kind of query string only. And changes submitted by patch will break for folks who think "a=None" is actually what they expected when the sent {a:None}.

I think, some present instances where this behavior is exhibited will be good to note.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18857>
_______________________________________


More information about the Python-bugs-list mailing list