#24234: Create Context object in a separate method
-------------------------------------+-------------------------------------
Reporter: AlexHill | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Template system | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: multiple-template- | Triage Stage: Accepted
engines |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):
* status: closed => new
* resolution: wontfix =>
Comment:
What could make sense is extracting a utility function in
django.template.context to encapsulate this weird pattern:
{{{
def make_context(request, context)
if request is None:
context = Context(context)
else:
# The following pattern is required to ensure values from
# context override those from template context processors.
original_context = context
context = RequestContext(request)
if original_context:
context.push(original_context)
}}}
And then use it in django.template.backends.django.Template.render.
--
Ticket URL: <https://code.djangoproject.com/ticket/24234#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 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/066.f7c594dc07a5d2e764c2c5be37534830%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.