[Django] #29356: request.GET.getlist default is [] instead of None

24 views
Skip to first unread message

Django

unread,
Apr 24, 2018, 3:08:58 PM4/24/18
to django-...@googlegroups.com
#29356: request.GET.getlist default is [] instead of None
------------------------------------------------+------------------------
Reporter: JorisBenschop | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
from https://docs.djangoproject.com/en/dev/ref/request-
response/#django.http.QueryDict.getlist:
QueryDict.getlist(key, default=None)¶
Returns a list of the data with the requested key. Returns an empty
list if the key doesn’t exist and a default value wasn’t provided

As far as I know an empty list, [] is not the same as None. should it thus
not be rewritten as:
QueryDict.getlist(key, default=[ ])¶

--
Ticket URL: <https://code.djangoproject.com/ticket/29356>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 24, 2018, 11:15:49 PM4/24/18
to django-...@googlegroups.com
#29356: request.GET.getlist default is [] instead of None
--------------------------------------+------------------------------------

Reporter: JorisBenschop | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/29356#comment:1>

Django

unread,
Apr 25, 2018, 6:58:10 AM4/25/18
to django-...@googlegroups.com
#29356: request.GET.getlist default is [] instead of None
--------------------------------------+------------------------------------

Reporter: JorisBenschop | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham):

I'm not sure -- you think we should document that something that differs
from
[https://github.com/django/django/blob/c591bc3ccece1514d6b419826c7fa36ada9d9213/django/utils/datastructures.py#L142-L147
the actual signature]?

--
Ticket URL: <https://code.djangoproject.com/ticket/29356#comment:2>

Django

unread,
Apr 25, 2018, 2:54:01 PM4/25/18
to django-...@googlegroups.com
#29356: request.GET.getlist default is [] instead of None
--------------------------------------+------------------------------------
Reporter: JorisBenschop | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz):

* status: new => closed
* resolution: => invalid


Comment:

Agreed with Tim, the signature is right, the return value is explained in
the paragraph. I can understand the confusion because the default
`default` value is not the default return value.

--
Ticket URL: <https://code.djangoproject.com/ticket/29356#comment:3>

Django

unread,
Oct 8, 2020, 3:51:21 AM10/8/20
to django-...@googlegroups.com
#29356: request.GET.getlist default is [] instead of None
--------------------------------------+------------------------------------

Reporter: JorisBenschop | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):

* status: closed => new
* has_patch: 0 => 1
* resolution: invalid =>


Comment:

There's a [https://github.com/django/django/pull/13510 PR with a small
adjustment to the docs] come in for this, which seems acceptable, so
reopening to take that.

--
Ticket URL: <https://code.djangoproject.com/ticket/29356#comment:4>

Reply all
Reply to author
Forward
0 new messages