[albatross-users] more data tricks for the wiki
Matt Goodall
matt at pollenation.net
Sun Jul 6 10:02:18 EST 2003
On Sun, 2003-07-06 at 00:32, Matt Goodall wrote:
> 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?
The answer is ... no. Phew ;-).
ListIterator has a __getstate__ method so only the start and pagesize
are pickled.
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