summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-14 18:29:15 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 17:02:29 +0100
commite53495ba3352c2c0fdb6178f2b333c30cb6b5d46 (patch)
treed2ff8c1eb9d616d86fbad2be97fc9e042b3761e3 /django
parentfdbfc98003f0ba2d3a12def63a75560791f3602d (diff)
Preserved context class in inclusion_tag.
Previously, when a template was rendered with RequestContext, inclusion tags were rendered with a plain context, losing additional information available in the RequestContext. The (admittedly bizarre) implementation of RequestContext.new() has the side-effect of not running template context processors, making this change backwards-compatible.
Diffstat (limited to 'django')
-rw-r--r--django/template/base.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/django/template/base.py b/django/template/base.py
index 8a0b638a54..6594af1e1a 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -1257,7 +1257,7 @@ class Library(object):
else:
raise TemplateSyntaxError("Invalid arguments provided to assignment_tag")
- def inclusion_tag(self, file_name, context_class=Context, takes_context=False, name=None):
+ def inclusion_tag(self, file_name, takes_context=False, name=None):
def dec(func):
params, varargs, varkw, defaults = getargspec(func)
@@ -1277,13 +1277,7 @@ class Library(object):
else:
t = context.engine.get_template(file_name)
self.nodelist = t.nodelist
- new_context = context_class(_dict, **{
- 'autoescape': context.autoescape,
- 'current_app': context.current_app,
- 'use_l10n': context.use_l10n,
- 'use_tz': context.use_tz,
- 'engine': context.engine,
- })
+ new_context = context.new(_dict)
# Copy across the CSRF token, if present, because
# inclusion tags are often used for forms, and we need
# instructions for using CSRF protection to be as simple