[Zope] ZPT: building to column table

Jochen Haeberle listen@midras.de
Thu, 12 Sep 2002 14:15:24 +0200


Hi Clemens,

>Hi Jochen,


>However I argue instead to reorder the results into two-tuples.
>e.g. define a script "pairwise" accepting one parameter "a":
>
>if len(a)%2==1:
>   # uneven list length: add a dummy
>   a.append("empty value")
>return [ (a[i],a[i+1]) for i in range(0, len(a)-1,2) ]
>
>
>and then do:
>
>  <metal:block tal:repeat="result python:here.pairwise(batch)">
>    <tr> 
>       <td tal:content="python:result[0]" />
>       <td tal:content="python:result[1]" />
>    </tr>
>  </metal:block>
>
>I guess TAL will like that (modulo syntax errors)
>
>Cheers,
>Clemens


Thanks a lot, works nearly like a charm :-)


regards

Jochen