I'm creating my own bespoke 404 / 400 error page by editing routes.py like 
this:

routes_onerror = [('app/400', '/app/default/custom_400.html')]

and I have 2 questions: 

1) The custom_400 page is displayed when from within a controller, I call 
e.g. 

raise HTTP(400, "my error message text")

How do I access/display the error message text within my custom_400.html 
page?

2) If it is is not an HTML view which is being called, but a JSON view, I 
want to return a JSON page instead which, for example, reads {"error":"my 
error message text"}. How do I do that? Can I just create a custom_400.json 
view, and remove the .html from my line in routes.py?

Thanks for any help

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4055b447-99fc-4a36-84a2-4b649e628d52n%40googlegroups.com.

Reply via email to