#!/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)