#29306: Prevent template variable lookups from intiatiating a class
---------------------------------+------------------------------------
Reporter: Luoxzhg | Owner: Luoxzhg
Type: Bug | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: template | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by Tim Graham):
I understand the desire for the behavior change, however, the change could
be backwards incompatible. Consider this case which will pass before the
change but fail afterward:
{{{
@setup({'t': '{{ A.attr }}'})
def test_class_attribute(self):
"""Accessing an attribute of an instantiated class."""
class A:
def __init__(self):
self.attr = 'Hello'
self.assertEqual(self.engine.render_to_string('t', {'A': A}), 'Hello')
}}}
Is there any documentation to suggest
[https://docs.djangoproject.com/en/dev/ref/templates/language/#variables
the current behavior] is incorrect?
--
Ticket URL: <https://code.djangoproject.com/ticket/29306#comment:4>
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.44d358496c38ee2681d524c30904562b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.