[web2py] Re: LOAD an routes_onerror
The redirect would go in the /error/default/index controller action. It sends a 200 response to the browser with a special header instructing web2py.js to do a client-side redirect (i.e., load a new URL in the address bar). Anthony On Friday, March 16, 2018 at 5:25:10 AM UTC-4, Annet wrote: > > Hi Anthony, > > Thanks for your reply. > > > Have you tried redirect(..., client_side=True) in your error handler? >> > > > The error handler error/default/index contains the following lines of > code: > > > def index(): > session.forget(response) > > response.title = 'Leonexus - Error handler' > > return dict() > > > I do not have a line redirect(..., client_side=True) in my code. Is it > possible to add > client_side = True to error_handler in routes.py > > error_handler = dict(application='error', > controller='default', > function='index', > client_side = True) > > > Kind regards, > > Annet > -- 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.
[web2py] Re: LOAD an routes_onerror
Hi Anthony, Thanks for your reply. Have you tried redirect(..., client_side=True) in your error handler? > The error handler error/default/index contains the following lines of code: def index(): session.forget(response) response.title = 'Leonexus - Error handler' return dict() I do not have a line redirect(..., client_side=True) in my code. Is it possible to add client_side = True to error_handler in routes.py error_handler = dict(application='error', controller='default', function='index', client_side = True) Kind regards, Annet -- 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.
[web2py] Re: LOAD an routes_onerror
Have you tried redirect(..., client_side=True) in your error handler? On Tuesday, March 6, 2018 at 3:38:35 AM UTC-5, Annet wrote: > > In my application I have a view containing a header, main and footer > component. > In the index function of a controller I have the following code: > > maincomponent = LOAD('home', 'base', args=[vertexID, viewtypeID, groupID, > plural], > ajax=True, target='main-component', content='') > > this loads the home page, all other pages are loaded in the main-component. > > I have a separate application which handles errors. In routes.py I have > the following > code: > > > routes_onerror = [ > (r'init/*', r'/error/default/index') >,(r'*/404', r'/error/default/index') >,(r'*/*', r'/error/default/index') > ] > > # specify action in charge of error handling > > error_handler = dict(application='error', > controller='default', > function='index') > > > The problem is that in case of an error the error_handler is being loaded > into > the main-component. Which results in the menu in the header displaying > multiple dropdown carets and the menu items not being clickable anymore. > > What is the best way to solve this issue? > > > Kind regards, > > Annet > -- 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.