On Sep 16, 2009, at 1:18 PM, David Zejda wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > > I returned to examine the problem more deeply, but now it behaves > differently and I do not know why, I do not remember any change, which > could cause the change. > > Now the error_handler entry in routes.py seems to be completely > ignored. > I tried further to make a simpliest testing scenario possible - > there is > application "error" with "default" controller only: > > def index(): > return dict(msg="aaa") > > def err(): > raise Exception("bbb") > > Error raised by "err" function results in standard error though > there is > > error_handler = dict(application='error', > controller='default',function='index') > > in routes.py. > > If I call index() directly (http://127.0.0.1:8000/error) it works > normally. The routes.py is not ignored in whole - change in > error_message works. > > Please, any ideas?
Just a reminder that the routes.py unit test for error handling fails. I sort of assumed that the test was bad, but maybe the test is fine and the code is bad. (I don't understand it myself, so I'm of no help there.) > > David > > mdipierro napsal(a): >> If this is the case I could use some help debugging it. >> >> Massimo >> >> On Sep 11, 7:54 am, David Zejda <d...@atlas.cz> wrote: >> Thank you for the help. >> >> I have one problem with the solution - it seems, that if there is >> custom >> error_handler in routes.py specified, the ticket is not being >> generated. >> No file with traceback information appears and also the >> request.vars.ticket is left undefined. >> >> David >> >> mdipierro napsal(a): >> >>>>> make app "error" with a controller default.py and an action >>>>> def index(): >>>>> from gluon.tools import Mail >>>>> mail=Mail() >>>>> mail.settings.server="smpt.example.com:port" >>>>> mail.settings.sender="y...@example.com" >>>>> mail.settings.login="you:password" >>>>> ticket=request.vars.ticket >>>>> subject="Ticket: %s" % ticket >>>>> message=bla bla bla >>>>> mail.sent >>>>> (to="administra...@example.com",subject=subject,message=message) >>>>> return "Sorry, an error occurred (%s), administrator has been >>>>> notified" % ticket >>>>> and then create a file web2py/routes.py and in it write: >>>>> error_handler = dict(application='error', controller='default', >>>>> function='index') >>>>> On Sep 10, 8:54 am, David Zejda <d...@atlas.cz> wrote: >>>>> Hello, >>>>> for a productive site I wish to touch the default error handler, >>>>> maybe >>>>> using some kind of decorator. IMO it would be good to >>>>> 1. retain the ticket generation >>>>> 2. notify admin by e-mail >>>>> 3. redirect client to a custom error page >>>>> I would like to do it site-wide - not using the decorators for all >>>>> controller functions one-by-one. >>>>> Please, I will appreciate your advices.. >>>>> Thanks a lot! >>>>> David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---