#24538: Rendering a Jinja template with a context containing 'self' fails
---------------------------------+-------------------------------------
Reporter: tim_heap | Owner: charettes
Type: Bug | Status: closed
Component: Template system | Version: 1.8rc1
Severity: Release blocker | Resolution: invalid
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by charettes):
* status: assigned => closed
* resolution: => invalid
Comment:
Unfortunately it looks like a limitation of Jinja2 itself:
{{{#!python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from jinja2 import Environment
>>> env = Environment()
>>> template = env.from_string('{{ self }}')
>>> template.render({'self': 'Self!'})
u'<TemplateReference None>'
}}}
I think the `TypeError` raised here makes more sense here than silently
ignoring the provided `self` context variable.
Attaching a test case leading to this conclusion.
--
Ticket URL: <https://code.djangoproject.com/ticket/24538#comment:2>
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/066.b33ae6efccf2d0c43ee8d7b08e703210%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.