#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-------------------------------------+-------------------------------------
     Reporter:  Andi Albrecht        |                    Owner:  reficul31
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Template system      |                  Version:  1.10
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Mark Jones):

 This was never about a RequestContext (although I can see that being a
 problem).  It had to do with a Context being passed to make_context and
 that causing a type error.  The whole point of me passing a Context was to
 specify turn off auto_escape
 {{{
             context = Context({"settings": settings,
                                "sys": sys, "os": os,
                                "options": options,
                                "username": getpass.getuser(),
                                "wsgi_path": wsgi_path,
                                "ssl": using_ssl,
                                },
                               autoescape=False)
 }}}

 I'm rendering a text file on the server in a management command where I'm
 selecting the template based on:

 {{{
             servertemplate = loader.select_template(["deployment/%s" %
 options['webserver'],
 "deployment/default_%s" % options['webserver']])

 }}}
 Because Jinja is incapable of using a context, we've broken the ability to
 pass a context.  The fix I proposed was to let that context on thru,
 instead the context is banned and the only way to get autoescape in now is
 to build out a whole template Engine (where the autoescape flag can be
 passed).

 I've never understood people's fascination with jinja templates but
 nothing made me use them.  But now they are actively thwarting me, I begin
 to dislike them.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/27258#comment:12>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.f8a9a76afd98e75db8cb90c11e3387c4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to