how to turn off Web2py ticketing system?
I wan开发者_C百科t to Web2py to just return the error screen/stack-trace... i don't want this ticketing system in place. how can I turn it off?
You cannot. If you are logged in as administrator and you click on the ticket number, it will open a window with the stack-trace. You can use routes_onerror in routes.py to display a different error page to your user and hide the ticket number if you do not wish to expose it.
I hide tickets from end users in our Web2py production environment by doing the following:
1) In the model (db.py) I test to see if I am in the production environment and if so, I add a variable called hide_ticket to the user's request:
# The is_production variable is read from an environment variable earlier.
if settings.is_production:
request.hide_ticket = True
2) Then modify gluon/main.py to this:
if request.hide_ticket:
http_response = \
HTTP(500, '<html><body><h1>Request Failed</body></h1></html><!--- IE Needs this' + ('x' * 512) + '--->' )
else:
http_response = \
HTTP(500, rwthread.routes.error_message_ticket %
dict(ticket=ticket),
web2py_error='ticket %s' % ticket)
Instead of this:
http_response = \
HTTP(500, rwthread.routes.error_message_ticket %
dict(ticket=ticket),
web2py_error='ticket %s' % ticket)
精彩评论