--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi_main.py Sat Feb 14 18:40:21 2009 +0200
@@ -0,0 +1,34 @@
+#!/usr/bin/python2.5
+
+"""
+ Simple WSGI CGI handler using wsgiref.handlers
+"""
+
+import wsgiref.handlers
+
+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/plain\r\n')
+ sys.stdout.write('\r\n')
+
+ # exception traceback
+ traceback.print_exc(100, sys.stdout)
+
+def run (app) :
+ """
+ Run CGI request
+ """
+
+ # create handler
+ cgi_handler = wsgiref.handlers.CGIHandler()
+
+ # run once
+ cgi_handler.run(app)
+