[issue18857] urlencode of a None value uses the string 'None'
James Addison added the comment: Thanks Senthil; please take your time. This isn't urgent, and would likely benefit from further standardization of the URL query string and/or form-encoded data formats (outside the Python project) to achieve consensus. A fully-considered answer at a later date would probably sit more comfortably with me than one that has any sense of time pressure. -- ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
James Addison added the comment: No problem, and thanks for the heads-up Tal! I'll raise this as a topic on python-dev if it still seems worth pursuing, after collecting some more thoughts about it. -- ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
James Addison added the comment: NB: There appears to be some relevant discussion in https://github.com/whatwg/url/issues/469 -- ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
James Addison added the comment: The pair of pull requests below implement None-preserving urlencode and parse_qs* via a default-disabled flag 'standalone_keys'. - https://bugs.python.org/pull_request19259 - https://bugs.python.org/pull_request19264 (they're also already linked with this issue, thanks to the neat GitHub/BPO integration) A benefit of the proposed serialization changes is that developers can opt-in to a scheme in which "{'a': None}" and "{'a': ''}" do not collide to the same encoded representation. Would it be possible to re-open this issue for discussion? -- ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
Change by James Addison : -- pull_requests: +19264 pull_request: https://github.com/python/cpython/pull/19949 ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
Change by James Addison : -- pull_requests: +19259 pull_request: https://github.com/python/cpython/pull/19945 ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18857] urlencode of a None value uses the string 'None'
James Addison added the comment: Chiming in here to add that I'd appreciate the ability to render 'standalone' (i.e. no '=') query-string keys in order to distinguish between absence-of-value and empty-string situations. The backwards-compatibility concerns in here are genuine, so perhaps this could be introduced as an argument to urlencode with a disabled default value, allowing developers to opt-in. >> Unless someone can point to a "real" web server that does something >> different with "" than with "=", there is no reason to make a change >> to Python. There's a popular nodejs library that makes this serialization distinction explicit: https://github.com/sindresorhus/query-string#falsy-values I've developed a Python 3.7-based set of commits[1] to address this issue. I haven't yet opened this as a pull request since I see that Python 3.7 is in maintenance/bugfix mode[2]. In case a new urlencode flag would fall under the category of feature, I'll aim to develop a subsequent set of commits against the master development branch soon. [1] - https://github.com/jayaddison/cpython/compare/3.7..9555467 [2] - https://devguide.python.org/#status-of-python-branches -- nosy: +jayaddison ___ Python tracker <https://bugs.python.org/issue18857> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com