Hello, 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. Thanks, Fernando
Fernando Martins wrote:
and this one does not??
<tr tal:repeat="msg msg_list" tal:attributes="bgcolor python:test(repeat['msg'].even, here.tablecolor4, here.tablecolor3)">
'even' is a method, so this needs to be "repeat['msg'].even()". Cheers, Evan @ 4-am
Evan Simpson wrote:
Fernando Martins wrote:
and this one does not??
<tr tal:repeat="msg msg_list" tal:attributes="bgcolor python:test(repeat['msg'].even, here.tablecolor4, here.tablecolor3)">
'even' is a method, so this needs to be "repeat['msg'].even()".
Thanks, this deserves an statement in the Zope book. I'll add a comment on-line but is it still worth to add comments to the zope book 2.5? (version 2.6 pages don't support them). Cheers, Fernando
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
participants (3)
-
Dieter Maurer -
Evan Simpson -
Fernando Martins