#36909: Avoid using context.request directly
-----------------------------+-------------------------------------------
     Reporter:  Jake Howard  |                     Type:  Bug
       Status:  new          |                Component:  Template system
      Version:  5.1          |                 Severity:  Normal
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  1            |                    UI/UX:  0
-----------------------------+-------------------------------------------
 The `RequestContext` subclass sets `context.request` to the current
 request object. This attribute isn't available when `Context` is used, or
 when something context-looking is used instead. For example, the new
 `querystring` tag accesses `context.request`, making it incompatible in
 some cases.

 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. It might also be
 worth renaming the attribute to `_request` to hint it shouldn't be used
 externally.

 This likely only occurs when template context is being incorrectly
 handled, but it's likely worth improving regardless.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36909>
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/0107019c3a7e3384-c06ee0d0-8984-4778-a8c2-4bb66c1ecbe9-000000%40eu-central-1.amazonses.com.

Reply via email to