[albatross-users] Having trouble implementing pagination
Sheila King
sheila at thinkspot.net
Tue Sep 30 17:40:15 EST 2003
OK, I'm tearing my hair out and am about to give up for tonight and go to
bed. LOL. Should have probably done that a couple of hours ago. Oh, well.
I just can't seem to get pagination with the al-for tag to work.
I understand that I need some sort of sequence type that has both __len__
and __getitem__ methods.
I'm returning a result of several rows in a MySQLdb object using the
Dictionary Cursor types.
A typical query result, after using fetchall() to get all the results,
would be something like this:
mydicts = ({'a': 1}, {'b': 2})
I have a class, that I use on individual dictionaries, such as the result
of a fetchone() command, that works really nicely. That class works fine by
itself.
However, today I tried to make some kind of a class that is a list of those
dictionary objects, because I want to iterate over them and use pagination.
But I am totally unable to have any kind of success at this.
I tried this:
class myclass(list):
def __getitem__(self, x):
return self[x]
But the above TOTALLY does not work and just recurses like mad until I hit
the maximum recursion level.
I tried a bunch of other stuff too. <sigh>
If someone can toss me a hint, I'd sure appreciate it.
Thanks,
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org
More information about the Albatross-users
mailing list