[Zope] formatting the results of Zsql methods
Tino Wildenhain
tino at wildenhain.de
Sat Sep 25 18:56:55 EDT 2004
Hi,
Am Sa, den 25.09.2004 schrieb garry saddington um 21:42:
> I can iterate over the result set from a Zsql method and have each result
> display across the page and wrap at the page border or I can have them
> display down the page. I can't work out how to have say five across the page
> and then have multiple rows each with five results. Could anyone point me in
> the right direction?
> regards
For example like this:
chunksize=5
all=context.YourZSQLMethod().dictionaries()
return [all[i:i+chunksize] for i in range(0,len(all),chunksize)]
this will return a list of lists with 5 elements each.
(the last list could be 1...5 elements)
You could use
<table>
<tr tal:repeat="rows here/the_python_script_above">
<td tal:repeat="col rows" tal:content="col">somevalue</td>
</tr>
</table>
More information about the Zope
mailing list