[albatross-users] more data tricks for the wiki

Matt Goodall matt at pollenation.net
Sun Jul 6 09:32:41 EST 2003


On Fri, 2003-07-04 at 01:42, Dave Cole wrote:
> >>>>> "Eric" == Eric S Johansson <esj at harvee.org> writes:
> 
> Eric> what's interesting is the difference in terms of what is
> Eric> returned.  An albatross, it's an iterator object; in Python
> Eric> iterators (as demonstrated by examples in the article referenced
> Eric> above) it's an ordinary piece of data (integer, float, string
> Eric> etc.).
> 
> One of the limitations that Albatross has to live with is that real
> iterators and generators cannot be pickled.  This means that they
> cannot be saved in a session.  If you use pagination in your <al-for>
> tag the ListIterator is placed in the session so it can "remember"
> where you were in the sequence.

Hmm, so the ListIterator is stored in the session and the ListIterator
contains a reference to the sequence being iterated over. Does that mean
that the whole sequence will be pickled, i.e. the entire result set from
a database query perhaps?

> Thinking out loud:
> 
> Currently pagination is handled by saving a ListIterator in the
> session.  The browser request then issues a nextpage or prevpage
> request and names the iterator.
> 
>     <al-a href="nextpage,i">next</al-a whitespace>
>     <al-input type="submit" nextpage="i" whitespace>
> 
> results in
> 
>     <a href="http://server/app.py/nextpage,i">next</a>
>     <input type="submit" name="nextpage,i">
> 
> Maybe a better way to do this would be to place all of the information
> required for pagination into the browser request.  This would result
> in output that looked something like this
> 
>     <a href="http://server/app.py/goto,i,20">next</a>
>     <input type="submit" name="goto,i,20">
> 
> The nice outcome of this would be that we do not need to save anything
> in the session anymore.  It would also allow you to bookmark specific
> pages in an application.

I was thinking of implementing this just the other day although my
reason for wanting purely request based paging was that clicking the
next page link and then using the browser's refresh button makes the
ListIterator jump forward another page.

My only thought so far on this matter is to add a scope attribute to the
<al-for> tag whose default value is "session", "request" being the other
choice.

Cheers, Matt

-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net



More information about the Albatross-users mailing list