[albatross-users] Having trouble implementing pagination

Michael C. Neel neel at mediapulse.com
Wed Oct 1 00:39:14 EST 2003


> Really? I was under the impression assigning to a variable in locals
> will only change the context during that page display. I haven't
> played with the persistent implementations like mod_python, but I
> think a new context is created for each service (with any session
> variables being imported each time).
> 

When it comes to bd connection and cursors, it's harder to hide the true
nature of the web app.  Yes you can have a cursor objest in a session,
but that cursor will not be active next time though a request, that
connection may have been closed after the first request or you might be
under a different apache child the next request with a different
database connection.  The work around for this is in using page_enter,
and not calling c.fetchall() directly:

page_enter(self, ctx):
	....
	ctx.locals._results = c.fetchall()

<al-for expr="_results" iter="row" pagesize="20"> 

That doesn't solve the other problem though, that being if there are
2000 records returned, we are storing 1980 records in the session that
are not displayed.  2000 might still be doable, but if it jumps to
20,000 we could be in trouble - definatly rules out cookie based
session, lol!

Mike



More information about the Albatross-users mailing list