From 5bcaa4a83dd243529376602a508d7ab8fff2e501 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Wed, 21 Sep 2011 16:11:43 +0200 Subject: Added handle_error() function. --- pyAggr3g470r.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 0185ae61..b45a19f6 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -52,9 +52,21 @@ def error_page_404(status, message, traceback, version): html += "\n
\n" + htmlfooter return html +def handle_error(): + """ + Handle different type of errors. + """ + html = htmlheader() + html += htmlnav + html += "

Sorry, an error occured" + html += "\n
\n" + htmlfooter + cherrypy.response.status = 500 + cherrypy.response.body = [html] + bindhost = "0.0.0.0" cherrypy.config.update({ 'server.socket_port': 12556, 'server.socket_host': bindhost}) cherrypy.config.update({'error_page.404': error_page_404}) +_cp_config = {'request.error_response': handle_error} # static files path = {'/css/style.css': {'tools.staticfile.on': True, \ -- cgit