#24622: Response "context" and "templates" not available in the Test Client when
using Jinja2 - Django 1.8
-------------------------------------+------------------------------------
     Reporter:  rivantis             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:  jinja2, test client  |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+------------------------------------

Comment (by carljm):

 I talked to Armin in IRC today and I think there might be a variant of
 option (3) that wouldn't be too bad. Armin says that
 `Environment._load_template`, while marked as private API, is stable
 enough to safely override, and all template renders (not just top-level)
 go through it. (Disclaimer: I haven't looked at code in detail, just
 relaying here). So instead of monkeypatching Jinja2, we could maybe
 provide our own subclass of `Environment` that people can use if they want
 this feature. The main detail to work out would be whether this
 `Environment` subclass always fires signals or only does it during test;
 even if we enabled it via monkeypatch like we do for DTL, we could at
 least be monkeypatching our own code in the subclass rather than Jinja2
 directly.

 (Personally I think we should rework the DTL system to not rely on
 monkeypatching either, but this requires some design decisions. It may be
 that the signals framework is fast enough in the no-listeners case now
 that we can safely just always send these signals, instead of monkey-
 patching them in for testing only.)

--
Ticket URL: <https://code.djangoproject.com/ticket/24622#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 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/066.3bdbe23fcfa07ace8d00180e4b9a6799%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to