[Zope] Batches in ZPT: not stateful, yet...

Stuart Bishop zen@shangri-la.dropbear.id.au
Wed, 22 Jan 2003 17:06:39 +1100


On Wednesday, January 22, 2003, at 09:50  AM, Tom Emerson wrote:

> Chris McDonough writes:
>> The state (batch_size, next_batch_start, etc.) is typically kept in 
>> the
>> query string.
>
> Right, I got that. But the batch itself: if I have a SQL method that
> is returning a result set, is that called for each subset of records
> in the batch?

Yes. Unless you choose to stuff the results into SESSION and use that
to iterate over. Doing this requires making the results picklable:

<tal:block condition="request/SESSION/results|nothing">
<tal:block condition="request/SESSION.set('results',[tuple(row) for row 
in path('here/zsqlmethod')]" />
</tal:block>
<table>
<tr tal:repeat="row request/SESSION/results">
<td tal:repeat="cell row" tal:content="cell">cell</td>
</tr>
</table>

Or something like that...

-- 
Stuart Bishop <zen@shangri-la.dropbear.id.au>
http://shangri-la.dropbear.id.au/