Menu

#15 Component.attributes is broken

closed-fixed
nobody
None
5
2005-07-28
2005-07-28
No

The Component.attributes accessor as in (release 0.98a)
will only look up a maximum of one level in the
inheritance graph to find an attribute.

I've attached a patch.

For specificity, here's untested example code which
will exercise the bug:

===in /a.myt===
<%attr>
foo = 'fooval'
</%attr>

===in /b.myt===
<%flags>
inherit = '/a.myt'
</%flags>
<%attr>
bar = 'barval'
</%attr>

===in /c.myt===
<%flags>
inherit = '/b.myt'
</%flags>

# This is okay; it finds the 'bar' attribute from /b.myt:
<% m.base_component.attributes['bar'] %>

# This throws an AttributeError, doesn't find /a.myt's,
'foo':
<% m.base_component.attributes['foo'] %>

=============

Discussion

  • Geoffrey T. Dairiki

    Patch to fix Component.attributes bug.

     
  • Mike Bayer

    Mike Bayer - 2005-07-28

    Logged In: YES
    user_id=1100624

    patch applied, CVS rev 1.77, and a test case added to
    test/component.py

     
  • Mike Bayer

    Mike Bayer - 2005-07-28
    • status: open --> closed-fixed