> > How i can use? > > def mycaller(f): > try: return f() > except *(HTTP...)* : return f() > else: raise(HTTP(400)) >
How about: def mycaller(f): try: return f() except HTTP: return f() except: raise HTTP(400) Anyway, what exactly are you trying to do? Do you want to send a 400 response regardless of the type of error generated by the function (note, that will only work for code in the function itself, not code in the models or view)? I'm not sure it's a good idea to play with response._caller -- that's not part of the framework API and could therefore change in the future. Another option is to use the routes_onerror functionality to always serve the same static error page, regardless of error type, or to direct all errors to a special error handling function, which can always issue a 400 error. See http://web2py.com/books/default/chapter/29/4#Routes-on-error. Anthony