#32010: Unexpected behaviour of MultiValueDict.getlist in conjunction with map
-----------------------------+--------------------------------------
Reporter: Etienne Ott | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 3.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Carlton Gibson):
* status: new => closed
* resolution: => invalid
Comment:
> mvdict = MultiValueDict({"number": "54321"})
This is incorrect usage. If instantiated manually (which is not part of
the documented public API) the value of each item should be a list.
Compare:
{{{
>>> mvdict = MultiValueDict({"number": "54321"})
>>> mvdict.getlist("number")
['5', '4', '3', '2', '1']
>>> mvdict = MultiValueDict({"number": ["54321"]})
>>> mvdict.getlist("number")
['54321']
}}}
Note that the public `QueryDict` handles this as required:
{{{
>>> from django.http import QueryDict
>>> q = QueryDict("number=54321")
>>> q.getlist("number")
['54321']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32010#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.121b880668ec7bcd94f10a66dcb0af7f%40djangoproject.com.