Re: [Django] #29306: Prevent template variable lookups from intiatiating a class

2018-04-11 Thread Django
#29306: Prevent template variable lookups from intiatiating a class
-+-
 Reporter:  Luoxzhg  |Owner:  Luoxzhg
 Type:  Bug  |   Status:  closed
Component:  Template system  |  Version:  master
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  template | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * status:  assigned => closed
 * resolution:   => duplicate


Comment:

 I think this is expected behaviour, that has a workaround.

 #15791 added a check for a `do_not_call_in_templates` attribute on a
 callable.

 Setting this to `True` in the example test case allows it to pass.

 This is documented in the
 [https://docs.djangoproject.com/en/2.0/ref/templates/api/#variables-and-
 lookups Variables and lookups] section of the Template API docs.

 Closing as a duplicate of #15791

-- 
Ticket URL: 
Django 
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/065.08d9ccc06d432519b4eb4cbed18eea3b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29306: Prevent template variable lookups from intiatiating a class

2018-04-10 Thread Django
#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: 
Django 
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/065.44d358496c38ee2681d524c30904562b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29306: Prevent template variable lookups from intiatiating a class (was: [bugs]Template variable-lookups system invoke class when access class attribute)

2018-04-10 Thread Django
#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
-+
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted
 * easy:  1 => 0


Comment:

 [https://github.com/django/django/pull/9864 PR]

-- 
Ticket URL: 
Django 
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/065.aa50dc474541be73693fc0d253703f3c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.