[Zope] Batch processing

Tom Deprez tom.deprez@uz.kuleuven.ac.be
Fri, 11 Aug 2000 10:56:47 +0200


Hi,

few q'ns concerning batch processing:

1. I want the user to be able to choose a batch-page. So, when a query is
done, I want to show something like :

 previous page 1 - 2 - 3 - 4 - 5 next page.

The following code works partly: ie. the one thing missing is that it
doesn't shows the current page. How can I implement this?

<dtml-in address_lookup previous size=5 start=query_start>
   <dtml-in previous-batches mapping>
     <dtml-unless sequence-start>&nbsp;
     </dtml-unless>
     <a href="<dtml-var document_id><dtml-var
sequence-query>query_start=<dtml-var batch-start-number>">
     <dtml-var
"(_.getitem('batch-start-index',0)/_.getitem('batch-size',0))+1"></a>
   </dtml-in>
</dtml-in>

<dtml-in address_lookup next size=5 start=query_start>
   <dtml-in next-batches mapping>
     <dtml-unless sequence-start>&nbsp;
     </dtml-unless>
     <a href="<dtml-var document_id><dtml-var
sequence-query>query_start=<dtml-var batch-start-number>">
     <dtml-var
"(_.getitem('batch-start-index',0)/_.getitem('batch-size',0))+1"></a>
   </dtml-in>
</dtml-in>

<dtml-in address_lookup size=5 start=query_start>
...
</dtml-in>

2. Is there an easier way to get what I want?

3. Does the above code means that it has to iterate 3 times over the list?
  Isn't there a way so that it needs only one pass over the list?

Thanks in advance,

Tom Deprez.