--- 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("""\
+<html><head><title>500 Internal Server Error</title></head><body>
+<h1>Oops!</h1>
+<p>
+ 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.
+</p>
+<p>
+ If you do so, please include the following information:
+</p>
+<h2>Details:</h2>
+<pre>%(traceback)s</pre>
+</body></html>
+""" % 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()