My app retrieves 10 records at a time, and the user can click Next to view each page in order . That works until they reach the end of the records, where they get IndexError: list index out of range.
To work around that problem, I wrote the following exception handling: try: redirect(URL(r=request,f='respond', args=p.id+1)) except IndexError: redirect(URL(r=request,f='index')) Which doesn't seem to work - I still get the error. Is there a better solution? I haven't yet figured out how to write logic that says "When the user gets near the end, retrieve another 10 records so he doesn't run out."