[Django] #33069: Comment to match code in django.form.widget.Widget.value_from_datadict

10 views
Skip to first unread message

Django

unread,
Aug 30, 2021, 3:49:18 AM8/30/21
to django-...@googlegroups.com
#33069: Comment to match code in django.form.widget.Widget.value_from_datadict
-----------------------------------------+------------------------
Reporter: Michael | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.2
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 |
-----------------------------------------+------------------------
The comment says it returns `None` if not provided, maybe you are
expecting a default dict to be passed in as `data`, in which case this
ticket is invalid, but if it is a normal dict:

django/form/widget.py line 258 (class Widget):
{{{
def value_from_datadict(self, data, files, name):
"""
Given a dictionary of data and this widget's name, return the
value
of this widget or None if it's not provided.
"""
return data.get(name)
}}}

then either the comment needs to trim `or None if it's not provided` or
the code changed to `data.get(name, None)`

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

Django

unread,
Aug 30, 2021, 3:59:42 AM8/30/21
to django-...@googlegroups.com
#33069: Comment to match code in django.form.widget.Widget.value_from_datadict
-------------------------------+--------------------------------------
Reporter: Michael | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

If works as documented with a dict, see
[https://docs.python.org/3/library/stdtypes.html?highlight=dict#dict.get
dict.get() docs].

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

Reply all
Reply to author
Forward
0 new messages