This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients Joshua.Johnston, orsenthil, r.david.murray
Date 2013-08-27.20:47:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377636445.32.0.194672592681.issue18857@psf.upfronthosting.co.za>
In-reply-to
Content
In Python the str of a None value is indeed 'None', just as the str of a True value is 'True'.  Unless the protocol to which you are encoding supports null values, you shouldn't be using None values in the input to the serialization.  If you want an empty string in the output, use an empty string in the input.

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

That is what I would expect it to do, so I'd be in favor of that enhancement.

I note that parse_qs and parse_qsl don't handle this case either, which surprises me since I think such value-less query string parameters are fairly common.
History
Date User Action Args
2013-08-27 20:47:25r.david.murraysetrecipients: + r.david.murray, orsenthil, Joshua.Johnston
2013-08-27 20:47:25r.david.murraysetmessageid: <1377636445.32.0.194672592681.issue18857@psf.upfronthosting.co.za>
2013-08-27 20:47:25r.david.murraylinkissue18857 messages
2013-08-27 20:47:25r.david.murraycreate