[Django] #22799: GET and POST on HttpRequest should be QueryDicts

32 views
Skip to first unread message

Django

unread,
Jun 9, 2014, 10:44:48 AM6/9/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
-------------------------------+--------------------
Reporter: duncan@… | Owner: nobody
Type: Uncategorized | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
On a new HttpRequest object, GET and POST are are empty dictionaries when
they really ought to be QueryDicts. This is not something you would
usually notice causing trouble in production as you get a WSGIRequest
instead of an HttpRequest, but in testing using the test client, calling
.getlist on GET or POST for a request with no get/post data results in an
AttributeError.

I've made a pull request to change this:
https://github.com/django/django/pull/2778

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

Django

unread,
Jun 10, 2014, 4:10:36 AM6/10/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
-------------------------------+--------------------------------------
Reporter: duncan@… | Owner: nobody
Type: Bug | Status: new

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by anonymous):

* needs_docs: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* needs_better_patch: => 0


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

Django

unread,
Jun 10, 2014, 5:35:26 AM6/10/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
--------------------------------------+------------------------------------
Reporter: duncan@… | Owner: nobody
Type: Cleanup/optimization | Status: new

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bmispelon):

* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Hi,

This seems like a reasonable feature to add.

I've left a comment on the pull request and on top of that, you should
also add a mention in the release notes for 1.8.

Thanks.

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

Django

unread,
Jun 10, 2014, 9:37:13 AM6/10/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
--------------------------------------+------------------------------------
Reporter: duncan@… | Owner: duncan
Type: Cleanup/optimization | Status: assigned

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by duncan):

* owner: nobody => duncan
* status: new => assigned


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

Django

unread,
Jun 10, 2014, 10:20:21 AM6/10/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
--------------------------------------+------------------------------------
Reporter: duncan@… | Owner: duncan
Type: Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by duncan):

I've updated the pull request in line with bmispelon's suggestions, let me
know if there is anything else you need.

Cheers,

Duncan

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

Django

unread,
Jun 24, 2014, 10:08:18 PM6/24/14
to django-...@googlegroups.com
#22799: GET and POST on HttpRequest should be QueryDicts
--------------------------------------+------------------------------------
Reporter: duncan@… | Owner: duncan
Type: Cleanup/optimization | Status: closed

Component: HTTP handling | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"fd4ccd045cf8edf0bf10ee0c576c7b7c5819170c"]:
{{{
#!CommitTicketReference repository=""
revision="fd4ccd045cf8edf0bf10ee0c576c7b7c5819170c"
Fixed #22799 -- Made GET and POST on HttpRequest QueryDicts, and FILES a
MultiValueDict.

Previously, GET, POST, and FILES on an HttpRequest were created in
the __init__ method as dictionaries. This was not something you would
usually notice causing trouble in production as you'd only see a
WSGIRequest, but in testing using the test client, calling .getlist
on GET, POST, or FILES for a request with no get/post data resulted in
an AttributeError.

Changed GET and POST on an HttpRequest object to be mutable
QueryDicts (mutable because the Django tests, and probably many
third party tests, were expecting it).
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22799#comment:5>

Reply all
Reply to author
Forward
0 new messages