error_message = '<html><body><h1>%s-------</h1></body></html>'
error_message_ticket = '''<html><body><h1>Internal error</h1>
Ticket issued: <a href="/admin/default/ticket/%(ticket)s"
target="_blank">%(ticket)s</a>------</body></html>'''
routes_onerror = [
('init/400', '/backend/default/index'),
('init/*', '/backend/default/index'),
('*/404', '/backend/default/index'),
('*/*', '/backend/error/report')
]
error_handler = dict(application='backend',
controller='error',
function='report')
if status >= 399 and THREAD_LOCAL.routes.routes_onerror:
error_handler = dict(application='backend',
controller='error',
function='report')
routes_onerror = [
('init/400', '/backend/default/index'),
('init/*', '/backend/default/index'),
('*/404', '/backend/default/index'),
('*/*', '/backend/error/report')
]
Well also now I got it (still not per app)... but the problem Im having is that I want to return a json, but Im getting the full HTML response with a body and all that.
Well also now I got it (still not per app)...
Well also now I got it (still not per app)... but the problem Im having is that I want to return a json, but Im getting the full HTML response with a body and all that.
If I useerror_handler = dict(application='backend',
controller='error',
function='report')
Nothing changes. So I have setup
routes_onerror = [
('init/400', '/backend/default/index'),
('init/*', '/backend/default/index'),
('*/404', '/backend/default/index'),
('*/*', '/backend/error/report')
]
I have as response this HTML instead of the json
<html><head><link rel="alternate stylesheet" type="text/css" href="resource://gre-resources/plaintext.css" ></head><body data-pinterest-extension-installed="ff1.37.9"><pre>{&#x27;message&#x27;: &#x27;Error interno&#x27;}</pre></body></html>
I mean, we have other web2py apps there, I dont want to modify the default behaviour of the other ones, only this "backend" app.
El martes, 20 de septiembre de 2016, 10:06:10 (UTC-5), Ty oc escribió:I thought it was a per app configuration.
El lunes, 19 de septiembre de 2016, 17:51:28 (UTC-5), Anthony escribió:routes.py goes in the root /web2py folder. Be sure to restart the server or reload routes (via admin). Also, make sure you don't actually have an error somewhere in your error handling app.