Expected behaviour:
They should work the same in the face of an empty list value.
See: https://github.com/django/django/pull/2268 for a patch making POST
behave as GET.
--
Ticket URL: <https://code.djangoproject.com/ticket/22079>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
As noted on the pull request, we may want to fix GET rather than POST.
In any case, they should behave similarly.
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:1>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:2>
* cc: gregchapple1@… (added)
Comment:
What is the desired behaviour here?
From what I can see, the difference lies with using
`django.utils.http.urlencode` to process the get params.
{{{
>>> from django.utils.http import urlencode
>>> data = {'test': ['value1', 'value2']
>>> urlencode(data, doseq=True)
'test=value1&test=value2'
>>> data = {'test': []}
>>> urlencode(data, doseq=True)
''
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:3>
* cc: apollo13 (added)
Comment:
From my gut I'd say that empty lists should get stripped out entirely,
cause there is no way to represent an empty list, "?test=" would be
interpreted as a list with one empty item in .getlist which makes no
sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:4>
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:5>
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
Comment:
What's the desired behavior here? If it's correcting getlist's handling of
empty lists, isn't that more in line with altering QueryDict than changing
serialization of GET params?
If we're still changing serialization, we might have to rewrite it
ourselves since our current serialization is derived from urllib which is
what causes the current bug mentioned by the ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:6>
* cc: Ahmad Abdallah (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:7>
* cc: Tom Forbes (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22079#comment:8>