Message196318
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. |
|
Date |
User |
Action |
Args |
2013-08-27 20:47:25 | r.david.murray | set | recipients:
+ r.david.murray, orsenthil, Joshua.Johnston |
2013-08-27 20:47:25 | r.david.murray | set | messageid: <1377636445.32.0.194672592681.issue18857@psf.upfronthosting.co.za> |
2013-08-27 20:47:25 | r.david.murray | link | issue18857 messages |
2013-08-27 20:47:25 | r.david.murray | create | |
|