[Zope] Returning database results similar to google search
Lyz at PrincessLeia.com
Lyz at PrincessLeia.com
Fri Dec 5 20:39:44 EST 2003
On Fri, Dec 05, 2003 at 01:08:01PM -0800, Dylan Reinhardt wrote:
>
> Here's an untested, top-of-head Python Script that assumes you pass in a
> variable called offset that defaults to 0.
>
> ----
> records = context.your_zsql_method(args)
> batch_size = 5
>
> last_record = min([offset+batch_size,len(records)])
>
> for record_num in range(offset, last_record):
> print records[record_num]['some_info']
>
> for page in range(0,len(results),batch_size):
> print '<a href=your_url?offset=%s>%s</a>' % (page,page/batch_size)
> return printed
> -----
>
> It's incomplete and ugly, but should get you well on your way.
>
> HTH,
>
> Dylan
This is exactly what I needed to get me on my way. Thanks so much!
--
Elizabeth K. // Lyz at PrincessLeia.com
http://www.princessleia.com
http://www.wallaceandgromit.net
More information about the Zope
mailing list