Try: cmd_opts = request.global_settings.cmd_options if request.function=="index" and not (cmd_opts and (cmd_opts.shell or cmd_opts.scheduler)): redirect(URL('splash'))
We should probably provide a more convenient method to check whether we have an http request vs. a shell or scheduler run (maybe a flag such as request.is_http_request). Feel free to submit a Google Code issue about this. Anthony On Saturday, July 26, 2014 9:38:54 PM UTC-4, Mark Li wrote: > > I am currently redirecting my "index" page to another page (the "splash" > page). The index page is the default function in my routes.py. The idea, is > that if a user visits the "index" page, they will get redirected to the > "splash" page, which works fine. At it's core, my redirect code looks like > this (inside a models file): > > > if request.function=="index": > redirect(URL('splash')) > > > However, upon using the interactive shell: > python web2py.py -M -S appname > > I get a 303 error and can't start the interactive shell, because the index > function is requested at the start of the interactive shell (causing a > redirect). I still want the index page to redirect to the splash page, but > the interactive shell does not work with the redirect code. Not quite sure > what the best way to go about this is. I have several background scripts > that run using the interactive shell; I would still like these to work, > while maintaining the redirect code for users visiting the front-end of the > site. > -- 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.