#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: closed
Component: Template system | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by Sayid Munawar):
Hi Tim, sorry to continue to discuss about this, from your last comment:
It's allowed to call {% include %} with a
`django.template.base.Template` but not
`django.template.backends.django.Template`
but `get_template()` will return
`django.template.backends.django.Template`.
further investigation using ipdb, i found that `make_context` will raise
type_error since the `context` is already an instance of `RequestContext`
in the 2nd iteration (see below):
{{{
>
/Users/ayik/Repo/Django/django/django/template/backends/django.py(65)render()
63 def render(self, context=None, request=None):
64 import ipdb; ipdb.set_trace()
---> 65 context = make_context(context, request,
autoescape=self.backend.engine.autoescape)
66 try:
67 return self.template.render(context)
ipdb> type(context)
<class 'dict'>
ipdb> c
>
/Users/ayik/Repo/Django/django/django/template/backends/django.py(65)render()
63 def render(self, context=None, request=None):
64 import ipdb; ipdb.set_trace()
---> 65 context = make_context(context, request,
autoescape=self.backend.engine.autoescape)
66 try:
67 return self.template.render(context)
ipdb> type(context)
<class 'django.template.context.RequestContext'>
ipdb>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27722#comment:6>
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.e073d848fe365a2dec1825bcdc4cbb82%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.