Opened 4 years ago

Closed 3 years ago

Last modified 21 months ago

#18659 closed Cleanup/optimization (fixed)

Remove `request.REQUEST`

Reported by: Aymeric Augustin Owned by: Bouke Haarsma
Component: HTTP handling Version: master
Severity: Normal Keywords:
Cc: marc.tamlyn@…, eduardocereto@…, bmispelon@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


request.REQUEST provides indifferent access to request.GET or request.POST (PHP style).

This attribute is a legacy from the pre-1.0 days, when you could access the GET or POST data using dict syntax on the request object. request.REQUEST was introduced in 1.0 to make this operation more explicit, with an easy upgrade path.

It's hardly ever a good design pattern to handle GET and POST identically, and it's our responsibility not to provide tools who are more likely to result in bad code than anything else. So I think it's time to deprecate this attribute.

We could deprecate django.utils.datastructures.MergeDict at the same time — it's a 100-lines long class whose sole purpose is to support request.REQUEST.

Change History (11)

comment:1 Changed 4 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by Aymeric Augustin

This may break a lot of code, so this isn't a decision to make lightly.

Django itself uses request.REQUEST in i18n views, auth, and admin.

comment:3 Changed 4 years ago by Marc Tamlyn

Cc: marc.tamlyn@… added

comment:4 Changed 4 years ago by Eduardo Cereto

Cc: eduardocereto@… added

comment:5 Changed 4 years ago by Aymeric Augustin

Component: Core (Other)HTTP handling

comment:6 Changed 4 years ago by Baptiste Mispelon

Cc: bmispelon@… added

comment:7 Changed 3 years ago by Bouke Haarsma

Owner: changed from nobody to Bouke Haarsma
Status: newassigned

I've proposed a deprecation in-between PR:

comment:8 Changed 3 years ago by Tim Graham

Has patch: set
Patch needs improvement: set
Version: 1.4master

Mailing list thread to make sure there is consensus to move forward with this:

The patch would also need to be updated to reflect the fact that the deprecation would start in 1.7 (1.6 is feature frozen at this time).

comment:9 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 2fb5a51fa3ac276efc7121ec9de91f092a986104:

Fixed #18659 -- Deprecated request.REQUEST and MergeDict

Thanks Aymeric Augustin for the suggestion.

comment:10 Changed 21 months ago by Tim Graham <timograham@…>

In 75f107b8842dfc890ddd65262bd09ca87c3a15be:

Removed request.REQUEST per deprecation timeline; refs #18659.

comment:11 Changed 21 months ago by Tim Graham <timograham@…>

In 37b7776a015102e97b9bdd64d88c732883ff9989:

Removed django.utils.datastructures.MergeDict per deprecation timeline; refs #18659.

Note: See TracTickets for help on using tickets.
Back to Top