#36909: Avoid using context.request directly
-------------------------------------+-------------------------------------
     Reporter:  Jake Howard          |                    Owner:  jaffar
                                     |  Khan
         Type:  Bug                  |                   Status:  new
    Component:  Template system      |                  Version:  5.1
     Severity:  Normal               |               Resolution:
     Keywords:  querystring          |             Triage Stage:
  requestcontext                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Jake Howard):

 * resolution:  needsinfo =>
 * status:  closed => new

Comment:

 My main motivation is exactly that - that there are situations where the
 context in a template is a `Context` instance rather than `RequestContext`
 (unintentionally or otherwise). I think the primary time this comes up is
 when a template is rendered manually, rather than using Django's helpers.
 [https://github.com/wagtail/wagtail/issues/12662 Wagtail] has hit this
 issue in its StreamField, which renders templates directly, rather than as
 part of the final request rendering (ie using `Context` rather than the
 special `RequestContext`).

 Having `querystring` (and other future tags) depend on having a `request`
 in the context makes sense, but assuming it is a `RequestContext` instance
 feels unnecessarily specific, especially since `RequestContext` is
 undocumented.

 Backwards compatibility wise, since `RequestContext` isn't a public API,
 tweaking the `RequestContext.request` behaviour shouldn't be especially
 breaking. Similarly, users of `querystring` won't notice a difference, and
 if anything will see strange incompatibilities resolved.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36909#comment:5>
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/0107019c44655522-876887e2-a209-40e3-8cc6-d160fcee3cc0-000000%40eu-central-1.amazonses.com.

Reply via email to