[Zope] repeat variable problem
Dieter Maurer
dieter@handshake.de
Fri, 27 Jun 2003 20:29:05 +0200
Fernando Martins wrote at 2003-6-27 16:21 +0200:
> I'm alternating colors in rows of a table using repeat/msg/even.
>
> How come this works
>
> <tr tal:repeat="msg msg_list" tal:attributes="bgcolor
> python:test(path('repeat/msg/even'), here.tablecolor4, here.tablecolor3)">
>
> and this one does not??
>
> <tr tal:repeat="msg msg_list" tal:attributes="bgcolor
> python:test(repeat['msg'].even, here.tablecolor4, here.tablecolor3)">
>
> This one always give the same color.
Because "even" is a method and (therefore) always true.
Try "python: ...repeat['msg'].even()..."
A path expression calls the final object automatically when it is callable.
Dieter