[albatross-users] Having trouble implementing pagination

Matt Goodall matt at pollenation.net
Wed Oct 1 07:28:57 EST 2003


Michael C. Neel wrote:

>I'm, not %100 on this, but yoo should be able to pass the fetchall()
>straight to the al-for.  I do this all the time with MySQLdb, using the
>normal cursor but that should make no difference here.
>
><al-for expr="c.fetchall()" iter="row" pagesize="20">
>	<al-exec expr="record = row.value()">
>	A: <al-value expr="record['a']">
></al-for>
>
>..should work ok.  I say should because I don't use the dict cursor, but
>iirc it returns a tuple of dicts, which should be just fine with the
>Iterator class of albatross.
>
>The gothca here is that the query will be preformed for every page
>(which you can work around) and the entire result set will be stored in
>the session (which you can't work around).
>
The query will be performed each request but the result set shouldn't be 
stored in the session with the above code ... unless I'm missing 
something. The only parts of row (the ListIterator object) that are 
stored in the session are the current start index and the pagesize.

Cheers, Matt

-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net
t: +44 (0)113 2252500





More information about the Albatross-users mailing list