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

2020-10-17 Thread James Addison
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

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

2020-10-17 Thread Senthil Kumaran
Senthil Kumaran added the comment: Hi James, I will give another look at it tonight or latest by Sunday PST , since I was involved in this and PRs. If we can make a decision within this context, great, otherwise we can open it up to python-dev On Sat, Oct 17, 2020 at 3:30 PM James Addison

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

2020-10-17 Thread James Addison
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

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

2020-10-17 Thread Tal Einat
Tal Einat added the comment: Thanks for the PRs, James! I've closed the PRs for now, to avoid having people spend time reviewing them while this issue is closed as "wontfix". That said, if further discussion changes that decision, the PRs could be reopened. -- nosy: +taleinat

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

2020-05-12 Thread James Addison
James Addison added the comment: NB: There appears to be some relevant discussion in https://github.com/whatwg/url/issues/469 -- ___ Python tracker ___

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

2020-05-06 Thread James Addison
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

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

2020-05-05 Thread James Addison
Change by James Addison : -- pull_requests: +19264 pull_request: https://github.com/python/cpython/pull/19949 ___ Python tracker ___

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

2020-05-05 Thread James Addison
Change by James Addison : -- pull_requests: +19259 pull_request: https://github.com/python/cpython/pull/19945 ___ Python tracker ___

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

2020-05-05 Thread James Addison
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

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

2015-06-25 Thread R. David Murray
R. David Murray added the comment: I see no reason for this issue to be open. As suggested on the linked bug, the value should be passed as an empty string (which will produce, eg foo=a='1', which is the correct format for such a parameter. Unless someone can point to a real web server that

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

2015-06-25 Thread Piotr Dobrogost
Piotr Dobrogost added the comment: This problem came out in the bug Cannot make URL query string with a parameter without a value (https://github.com/kennethreitz/requests/issues/2651) raised in urllib3 project (which itself is being used by Requests library mentioned in this bug).

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

2014-02-07 Thread R. David Murray
R. David Murray added the comment: What is returning a field dictionary containing None instead of an empty string? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857 ___

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

2014-02-07 Thread Joshua Johnston
Joshua Johnston added the comment: In this exact example it would be an empty string. It was a fake setup to illustrate a real problem. This is the important part: params = dict(screen_name=None,count=300) url = https://api.twitter.com/1.1/friends/ids.json?; + urllib.urlencode(params) print

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

2014-02-07 Thread R. David Murray
R. David Murray added the comment: None of those problems exist if you correctly use the empty string to indicate an empty string value instead of trying to use None. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857

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

2014-02-07 Thread Joshua Johnston
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

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

2014-02-07 Thread R. David Murray
R. David Murray added the comment: No, the domain of URIs does not have *any* concept of a null value. It only has the concept of a string being empty or not empty (or the key not existing at all...ie: it doesn't exist in your params dict). You are trying to map a Python concept (the

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

2014-02-07 Thread Joshua Johnston
Joshua Johnston added the comment: I'm sorry to reopen this but after it biting me quite a few times more I still cannot think of a valid use-case for this behavior that someone would be depending on 'None' being passed. I think your backwards compatibility concerns are artificial. Can anyone

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

2014-02-07 Thread Joshua Johnston
Joshua Johnston added the comment: While the RFC makes no mention of empty values either way, it has become standard practice to either omit the key-value completely or pass a key (optional = sign) by itself in these situations so I would consider that as standard behavior. While I stand by

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

2013-09-30 Thread R. David Murray
R. David Murray added the comment: No, Senthil is correct. My original liking for this idea came from my mistaken impression that a value without an '=' was different from a value with an '='. But clearly the practice in the industry (the de facto standard) is that they are the same, and

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

2013-09-30 Thread Joshua Johnston
Joshua Johnston added the comment: I agree with True == 'True' and False == 'False' but None should be empty since it represents the absence of a value akin to null, Nil, etc in other languages. Ultimately it is not my decision make so I can only agree to disagree. Thanks for having this

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

2013-09-30 Thread R. David Murray
R. David Murray added the comment: If we were making this decision de novo, we might decide it that way. However, the current behavior has been in place for a long time, so backward compatibility concerns raise the bar high enough that the costs of the change outweigh any benefits, even if

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

2013-09-29 Thread Joshua Johnston
Joshua Johnston added the comment: Hi Senthil, You can open the html file with a browser and inspect the data posting to itself without a web server running. That is how I tested. -- ___ Python tracker rep...@bugs.python.org

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

2013-09-29 Thread Joshua Johnston
Joshua Johnston added the comment: I still believe that since None represents the absence of a value it should not be urlencoded as the string 'None'. I am not sure what they best way to url encode it is, but I know that 'None' is not it. -- status: closed - open

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

2013-09-28 Thread Senthil Kumaran
Senthil Kumaran added the comment: Hi Joshua, I did not setup a php server to test the html form that you uploaded. We cannot test this in browsers because HTML does not have None as values, it is simple empty strings and that is correct. I think that the cost of making this change is higher

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

2013-09-16 Thread Claudiu.Popa
Claudiu.Popa added the comment: No problem, David, working on these patches is just an occasion for me to learn more and be useful at the same time. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857

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

2013-09-16 Thread Joshua Johnston
Joshua Johnston added the comment: I know that languages like php will treat ?josh= the same as ?josh Using the attached test form in Google Chrome, you will see the data passed as josh= when empty in both GET and POST requests. This is probably the way to go, key=str(value) if value is not

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

2013-09-15 Thread Claudiu.Popa
Claudiu.Popa added the comment: Hello. I attached a simple patch for the urlencode case. I'll try to make one for parse_qs(l) as well. -- keywords: +patch nosy: +Claudiu.Popa Added file: http://bugs.python.org/file31782/urllib.patch ___ Python

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

2013-09-15 Thread Claudiu.Popa
Claudiu.Popa added the comment: Added patch for parse_qsl as well. -- Added file: http://bugs.python.org/file31785/urllib_null_value.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857

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

2013-09-15 Thread Senthil Kumaran
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

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

2013-09-15 Thread R. David Murray
R. David Murray added the comment: Thank you for working on the patches, Claudiu, but... The backward compatibility concern is valid. Furthermore, I did a bunch of googling looking for examples. I did not turn up any examples of APIs that were documented to use parameters without '='...all

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

2013-09-04 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857 ___ ___

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

2013-08-27 Thread Joshua Johnston
New submission from Joshua Johnston: This is strange behavior. When you encode nulls in other languages you don't get the string 'null' you usually get an empy string. Shouldn't str(None) == ''? If not str(None) == 'None' and the string representation of a None value should not match a known

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

2013-08-27 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18857 ___ ___ Python-bugs-list mailing

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

2013-08-27 Thread R. David Murray
R. David Murray added the comment: 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

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

2013-08-27 Thread Joshua Johnston
Joshua Johnston added the comment: Hi David, That is what I would expect it to do as well. I'm relatively new to Python but this is causing all kinds of problems with oauth signing using ims_lti_py as well as my own code using urlencode. -- ___