#20570 closed Cleanup/optimization (invalid)
HttpRequest.REQUEST is still mentioned in the documentation
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The documentation page https://docs.djangoproject.com/en/dev/ref/request-response/ still mentions HttpRequest.REQUEST as an alternative to HttpRequest.GET and HttpRequest.POST
However I get an error when I try to access this attribute, and in addition it does not appear in the class documentation at https://code.djangoproject.com/wiki/HttpRequest which leads me to believe that this attribute no longer exists. It should be removed from the the request-response documentation page.
Change History (4)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Ah, sorry! I think my problem was that I was using RequestFactory https://docs.djangoproject.com/en/1.5/topics/testing/advanced/ to generate the request. My best guess is that the RequestFactory class does not produce an HttpRequest with a REQUEST attribute.
comment:3 by , 12 years ago
Hi,
It seems to be working fine for me:
>>> from django.test.client import RequestFactory >>> request = RequestFactory().get('/foo/?bar=baz') >>> request.GET <QueryDict: {'bar': ['baz']}> >>> request.REQUEST MergeDict(<QueryDict: {}>, <QueryDict: {'bar': ['baz']}>)
Can you provide some steps to reproduce your issue?
Thanks.
comment:4 by , 12 years ago
Sorry, turns out was not RequestFactory either. I was hand-generating a request like this:
r = HttpRequest() r.method = 'GET' r.GET = QueryDict('foo')
RequestFactory( ) still works fine, this was just an oversight on my part. Sorry to waste everyone's time!
It does still exist. Your link is to the wiki, not the official documentation: https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.REQUEST
That being said, there is a ticket to deprecate it, #18659.