Hi.
I have set up anerror handler on routes.py as:
routes_onerror = [(r"*/*", r"/admin/errors/index")]
Its quite slow but its fine for now.
The problem is that im trying to emulate a failed response out of an ajax
request and its taking 15 secs to respond, using on the controller:
raise HTTP(500, "Cant do")
It looks like this response goes through the error handler, but how can i
detect this is intentional?
There are not tickets being generated so i know the HTTP 500 doing its
thing, instead of dealing with an application error.
error handler code:
import mechanize, os
def index():
try:
code = request.vars.code
ticket = request.vars.ticket
print "Error code:", code, ticket
if ticket is None or ticket == "None":
return "%s: Not found" % code
url = "http://localhost/admin/default/ticket/" + ticket
try:
br = mechanize.Browser()
br.set_handle_robots(False)
if DEMO_MODE:
res = br.open(url)
else:
br.open(url)
br.select_form(nr=0)
br['password'] = "***********"
res = br.submit()
return res.read()
except Exception as e:
return str(e)
except Exception as e:
return str(e)
controller code:
def index():
if request.ajax and request.post_vars:
session.forget()
raise HTTP(500, "Cant do")
...
When i disable the error handler the HTTP 500 response is fast again. How
would i do so intentionals HTTP(500) bypass the error handler or are
detected by it?
Thanks
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/09e29228-545b-471d-ab22-6b4e1b1bfee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.