[Zope-dev] Two small ZPT suggestions
Adrian van den Dries
avdd@flow.com.au
Thu, 17 Jul 2003 14:36:32 +1000
On July 17, Toby Sargeant wrote:
> <table tal:repeat="row rows">
> <tal:block tal:define="casevar row/rowtype">
> <tr tal:condition="python:casevar='group'">...</tr>
> <tr tal:condition="python:casevar='user'">...</tr>
> <tr tal:condition="python:casevar='files'">...</tr>
> </tal:block>
> </table>
Why bother with the tal:define? Just:
<table tal:repeat="row rows">
<tr tal:condition="python:row.rowtype=='group'">...</tr>
<tr tal:condition="python:row.rowtype=='user">...</tr>
<tr tal:condition="python:row.rowtype=='files">...</tr>
</table>
which is just a direct translation of the corresponding Python:
for row in rows:
if row.rowtype=='group':
# etc
a.
--
Adrian van den Dries avdd@flow.com.au
Development team www.dev.flow.com.au
FLOW Communications Pty. Ltd. www.flow.com.au