# HG changeset patch # User Tero Marttila # Date 1234739003 -7200 # Node ID 088aa2da1340282d924b865eeb3e38376754b329 # Parent 0e857c4a67dee87835e4afb4ba73ed208e97cf64 our own CGI error handler diff -r 0e857c4a67de -r 088aa2da1340 index.cgi --- a/index.cgi Mon Feb 16 00:54:25 2009 +0200 +++ b/index.cgi Mon Feb 16 01:03:23 2009 +0200 @@ -4,6 +4,33 @@ CGI mode using qmsk.web.cgi """ +def error () : + """ + Dumps out a raw traceback of the current exception to stdout, call from except + """ + + import traceback, sys + + # HTTP headers + sys.stdout.write('Status: 500 Internal Server Error\r\n') + sys.stdout.write('Content-type: text/html\r\n') + sys.stdout.write('\r\n') + sys.stdout.write("""\ +500 Internal Server Error +

Oops!

+

+ An error occured, which was not logged, and will not be reported to anybody. It might be your fault, or it might be + the programmer's, but it's probably not mine. If you think you really care, you can try poking the administrator of + this site to see if they respond. +

+

+ If you do so, please include the following information: +

+

Details:

+
%(traceback)s
+ +""" % dict(traceback=traceback.format_exc())) + def main () : """ Build our wsgi.Application and run @@ -21,7 +48,7 @@ except : # display error on stdout - cgi_main.error() + error() if __name__ == '__main__' : main()