Opened 4 years ago

Closed 3 years ago

Last modified 20 months ago

#18659 closed Cleanup/optimization (fixed)

Remove `request.REQUEST`

Reported by: aaugustin Owned by: bouke
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

  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by aaugustin

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 mjtamlyn

  • Cc marc.tamlyn@… added

comment:4 Changed 4 years ago by eduardocereto

  • Cc eduardocereto@… added

comment:5 Changed 3 years ago by aaugustin

  • Component changed from Core (Other) to HTTP handling

comment:6 Changed 3 years ago by bmispelon

  • Cc bmispelon@… added

comment:7 Changed 3 years ago by bouke

  • Owner changed from nobody to bouke
  • Status changed from new to assigned

I've proposed a deprecation in-between PR:

comment:8 Changed 3 years ago by timo

  • Has patch set
  • Patch needs improvement set
  • Version changed from 1.4 to master

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 set to fixed
  • Status changed from assigned to closed

In 2fb5a51fa3ac276efc7121ec9de91f092a986104:

Fixed #18659 -- Deprecated request.REQUEST and MergeDict

Thanks Aymeric Augustin for the suggestion.

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

In 75f107b8842dfc890ddd65262bd09ca87c3a15be:

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

comment:11 Changed 20 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