[Zope] ZPT: building two column table

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


>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>


This works basically fine, except that my "batch" holds complex 
objects I get from the portal_catalog. So I added
tal:define="oddObj python:result[0];evenObj python:result[1]

Getting attributes from those objects works fine for most part, 
except when I try to build a url like

<a href="/view" tal:attributes="href oddObj/absolute_url">

or

a href="view" tal:attributes="href string:${evenObj/id}/sfbdok_view">

the generated HTML has "portal_catalog" in it... why's that and what 
can I do about it?

Thanks
Jochen