#16307: Unable to expand (resolve) template variable attribute when the 
variable is
a python class
---------------------------------+------------------------------------
     Reporter:  sorin            |                    Owner:  nobody
         Type:  Bug              |                   Status:  reopened
    Component:  Template system  |                  Version:  SVN
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by lukeplant):

 This will, of course, break anyone who had a class like:
 {{{
 class Foo(object):
     def __init__(self):
         self.bar = 123
 }}}

 and then did 'Foo.bar' in a template with `{'Foo':Foo}` passed in as the
 context.

 Is that a silly thing to do? Well, that's debatable, but it has one
 massive thing in its favour: it is the status quo, and every change we've
 ever made in this section of code has generated 'regression' bug reports.

 The docs clearly state: "If any part of the variable is callable, the
 template system will try calling it", which is exactly what happens.
 Personally I'm finding it hard to see the bug here.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16307#comment:8>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to