db.select returns webpy's flavored iterator, to get a list from it wrap the result in list()
p = list(db.select(person)) On Nov 1, 6:43 am, theiostream <daniel.calib...@gmail.com> wrote: > Hi, > > After doing some messing with lists which I get from a db.select, I > keep getting an exception which is "already passed [depending-int]" > everytime I want to do some comparison to it using the if statement. > > Doing some quick looking on webpy's code, I could see it's an > exception thrown by the own framework, although I don't really get its > reason... And is there a fix? > > This is my code: > > db = web.database(dbn='postgres', user='postgres', pw='', db='mydb') > def GET(self, person): > global db > p = db.select(person) > > i = p[len(p)-1].rname > if i==None: return 'Error.' > > return p[len(p)-1].rname -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.