> > replies = db(db.answers.author == auth.user.id).select(db.answers.ALL)[-7 > :-1]#:-1]##if getting upto the last record, it appears twice when posting > on view > question = db(db.answers.author == auth.user.id).select(orderby=~db. > answers.created_on,limitby=(2,0)) >
What are you trying to achieve with limitby=(2, 0)? That doesn't make sense (it results in a negative LIMIT value, which will either generate an error or be ignored). If you want the latest two values, it should be (0, 2), not (2, 0). > > answer = db(db.answers.author == auth.user.id).select(orderby=~db. > answers.created_on, limitby=(2,0)) > q = '' > a = '' > for q in question: > q = XML(q.quest, sanitize=True) > Assuming question contains more than one record, what is the point of looping here -- you only end up with the final record being assigned to q. You should just select a single record and use that (no loop needed). > > for a in answer: > a = XML(a.message, sanitize=True) > return dict(form=form, q=q, a=a, replies=replies) > It doesn't appear that q or a are used in the view. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

