#36909: Avoid using context.request directly in querystring template tag
-------------------------------------+-------------------------------------
Reporter: Jake Howard | Owner: Yogya
| Chugh
Type: Bug | Status: assigned
Component: Template system | Version: 5.1
Severity: Normal | Resolution:
Keywords: querystring | Triage Stage: Accepted
requestcontext |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Yogya Chugh ):
Replying to [comment:17 Jake Howard]:
Yes, renaming request to _request attribute in RequestContext and updating
other references makes sense and it's the next step but my concern is
querystring.
Our goal ( in querystring ) is to replace usage like context.request so as
not to assume it's a RequestContext. And as u mentioned in description,
I'd suggest that uses of context.request directly be replaced with
`context["request"]`, and that RequestContext automatically add request to
its own context if it's not there already.
The testcase fail I talked in previous comment is due to RequestContext
adding request to it's own context {{{self.setdefault("request",
request)}}}.
Going from request to _request attribute is a name change in multiple
places and is perfectly fine but request being present in context triggers
`test_sidebar_aria_current_page_missing_without_request_context_processor`
because it doesn't expect request being in context when context processor
is disabled.
So renaming request to _request **in context** was just a temporary fix to
this, nothing else.
What are your thoughts ?
--
Ticket URL: <https://code.djangoproject.com/ticket/36909#comment:18>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019c6d621167-bc758288-6c46-4b1d-acaf-569bf4114a3b-000000%40eu-central-1.amazonses.com.