[Zope] Retrieving a set number of entries

Tino Wildenhain tino at wildenhain.de
Wed Oct 22 14:43:04 EDT 2003


Hi Lalo,

Lalo Castro wrote:
> Hi,
>     I'm building a database interface in Zope.  We are using Zope 2.6, 
> Python 2.1.3, and the database is in PostGreSQL 7.3.3.  The problem I am 
> having is trying to search the database and return a set number of 
> entries. Like how Yahoo! returns 25 possibilities in it's search per 
> page.  Or how Google returns 10.  I'd like to know how to code it so 
> that a database search returns a set number of entries found, and can 
> make pages with multiple entries if there's more than the set number of 
> entries on a page.  Anyone have any ideas?

Dont be mislead by the other answers :)
I hope you dont have to use DTML, so you
can concentrate on the recommended way.

The key here is to use the
ZTUtils.Batch class as utility for batching
(API documentation is in the ZopeBook,
there are several examples you will find
with Google.
Try not to mix it into ZPT, like some examples
show but use a small python script and
return the values from there.

Good luck
Tino Wildenhain




More information about the Zope mailing list