#27570: Make context processor run outside of RequestContext
-------------------------------------------+------------------------
Reporter: Anthony King | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Not all templates are generated within the context of a request, such as
email rendering.
This prevents you accessing variables that are set in your context
processors.
In our codebase, we pass in some settings and other constants via a
context processor, which never looks at the request object.
It would be convenient for those constants to be used in all templates, as
apposed to templates with requests only.
I see 2 possible approaches to adding this functionality:
- Add a constant_processor, however this wrongly limits it to constants.
- make the request argument optional going forward, and use arg
inspections to conditionally context processors for a period.
Using `some_context_processor(request=None)` would show the processor
supports request objects not being set.
--
Ticket URL: <https://code.djangoproject.com/ticket/27570>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.94e2a3c515bd5860bc7ded07b5dd1a09%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.