#15721: {% include %} and RequestContext fails since r15795
-----------------------------+---------------------------
 Reporter:  mk               |         Owner:  nobody
   Status:  new              |     Milestone:
Component:  Template system  |       Version:  1.3
 Keywords:                   |  Triage Stage:  Unreviewed
Has patch:  1                |
-----------------------------+---------------------------
 Problem 1 is that RequestContext? does not accept the autoescape
 parameter.

 Problem 2 is that self.class might be a RequestContext? instance, not only
 a context instance -- meaning that either RequestContext? would have to
 override new() and include the request, or (as is in the patch) the
 Context class should be hardcoded, because the "only" handling would be
 circumvented when a new RequestContext? is created and all context
 processors are run, again.

 This patch fixes the problem for me:

 {{{
 diff --git a/django/template/context.py b/django/template/context.py
 index bcfaa3b..5749e0c 100644
 --- a/django/template/context.py
 +++ b/django/template/context.py
 @@ -104,7 +104,7 @@ class Context(BaseContext):
          Returns a new Context with the same 'autoescape' value etc, but
 with
          only the values given in 'values' stored.
          """
 -        return self.__class__(dict_=values, autoescape=self.autoescape,
 +        return Context(dict_=values, autoescape=self.autoescape,
                                current_app=self.current_app,
 use_l10n=self.use_l10n)

  class RenderContext(BaseContext):
 @@ -167,8 +167,8 @@ class RequestContext(Context):
      Additional processors can be specified as a list of callables
      using the "processors" keyword argument.
      """
 -    def __init__(self, request, dict=None, processors=None,
 current_app=None, use_l10n=None):
 -        Context.__init__(self, dict, current_app=current_app,
 use_l10n=use_l10n)
 +    def __init__(self, request, dict_=None, processors=None,
 autoescape=True, current_app=None, use_l10n=None):
 +        Context.__init__(self, dict_, autoescape=autoescape,
 current_app=current_app, use_l10n=use_l10n)
          if processors is None:
              processors = ()
          else:
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15721>
Django <http://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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to