#27722: if a template context is an instance of get_template(), it will raise
"TypeError: context must be a dict rather than RequestContext"
---------------------------------+------------------------------------
Reporter: Sayid Munawar | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by Tim Graham):
A use case for calling `{% include %}` with a compiled template is
described in #17356. The use case was for `{% include %}` with a
`django.template.base.Template`, however, it had the side effect of also
allowing `django.template.backends.django.Template` since the check is if
the `template` argument
[https://github.com/django/django/blob/d1bab24e0144d14513a1411503c95ececb425188/django/template/loader_tags.py#L174-L175
has a render() method].
I don't think the issue here has to do with how contexts are handled but
rather that `{% include "string" %}` uses
[https://github.com/django/django/blob/d1bab24e0144d14513a1411503c95ececb425188/django/template/loader_tags.py#L181
engine.get_template()] to load the template which returns `base.Template`.
The use case of this ticket instead uses `loader.get_template()` which
returns a `django.Template`.
In ticket:27258#comment:6 you said,
"`template.backends.django.Template.render` mustn't be called with a
`RequestContext` (I feel strongly about that one)." but that's what
happening in the latter case (apparently without any ill effects?).
--
Ticket URL: <https://code.djangoproject.com/ticket/27722#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 [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/065.f60496baa7405afcf8e0184fbfb85cba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.