I am trying to run some "helloworld" test application with repoze.bfg, and
found 2 problems with the "tal:repeat" Chameleon templates.
(with the latest versions: repoze.bfg 1.0, chameleon.zpt 1.0.0,
chameleon.core 1.0.0)

1. This code, taken from the documentation (at

        <tr tal:repeat="item here.cart">
            <td tal:content="repeat.item.number">1</td>
            <td tal:content="item.description">Widget</td>
            <td tal:content="item.price">$1.50</td>

results in:
   AttributeError: 'repeatdict' object has no attribute 'item'
Dictionary access works OK, so if "repeat.item.number" is changed to
"repeat['item'].number()", then the template is displayed correctly.
Documentation says: "You can access the contents of the repeat variable
using either dictionary- or attribute-style access, e.g.
repeat['item'].start or repeat.item.start."
So this looks like either a documentation problem, or a bug in the code.

2. Attributes of a repeat variable in the examples are used without
parentheses at the end (like "repeat.item.number"), while the docs say:
"""With the exception of start, end, and index, all of the attributes of a
repeat variable are methods and must be called explicitly, e.g.
In fact, when the parens are skipped, then the method name is displayed in
the rendered page, something like:

 <bound method repeatitem.number of <chameleon.core.utils.repeatitem object
at 0x306e5d0>>

Please look into that, I can file a bug report if needed.
Repoze-dev mailing list

Reply via email to