#29306: [bugs]Template variable-lookups system invoke class when access class
attribute
---------------------------------+--------------------------------------
     Reporter:  Luoxzhg          |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  master
     Severity:  Normal           |               Resolution:
     Keywords:  template         |             Triage Stage:  Unreviewed
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  1                |                    UI/UX:  0
---------------------------------+--------------------------------------
Description changed by Luoxzhg:

Old description:

> {{{
> class A:
>     class B:
>          attr="Hello"
>
> from django.template import Template, Context
> t = Template(" {{  A.B.attr }}")
> output=t.render(Context({"A": A}))
> }}}
>
> the output should be "Hello", but it is string_if_invalid, i.e., empty
> string "" .

New description:

 {{{
 class A:
     def __init__(self, value):
          pass
     attr="Hello"

 from django.template import Template, Context
 t = Template(" {{  A.attr }}")
 output=t.render(Context({"A": A}))
 }}}

 the output should be "Hello", but it is string_if_invalid, i.e., empty
 string "" .

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29306#comment:1>
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 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.55b69e6ffef3ce8f977040371be79b81%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to