if len(request.args) >= 3 and request.args[-3] == 'view': or:
if request.args(-3) == 'view': request.args(index) is the same as request.args[index], except the former returns None rather than raising an exception if the index is out of range. Finally, you could just do: if 'view' in request.args: The above should work as long as you're not working with a table named "view" (so there won't be any false positives). Anthony On Thursday, November 19, 2015 at 4:28:24 AM UTC-5, Gael Princivalle wrote: > > Hello all. > > With a grid I use a custom single record view. > > So in my view I have this test: > > if request.args and request.args[-3] == 'view': > > for displaying the custom single record view. > > But when I click on the add record button I have this error: > <type 'exceptions.IndexError'> list index out of range > Is there a way to use a custom single record view and the standard view > for adding a record? > > Thanks, regards. > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.