diff -r 9c7769850195 -r 6db2527b67cf bin/index.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/index.cgi Sun Sep 13 01:15:56 2009 +0300 @@ -0,0 +1,49 @@ +#!/usr/bin/python2.5 + +""" + CGI mode using qmsk.web.cgi +""" + +def error () : + """ + Dumps out a raw traceback of the current exception to stdout, call from except. + + Used for low-level ImportError's + """ + + import sys + + # if this import fails, we're doomed + from qmsk.irclogs import error + + # format info + status, content_type, body = error.build_error() + + # HTTP headers+body + sys.stdout.write('Status: %s\r\n' % status) + sys.stdout.write('Content-type: %s\r\n' % content_type) + sys.stdout.write('\r\n') + sys.stdout.write(body) + +def main () : + """ + Build our wsgi.Application and run + """ + + try : + from qmsk.web import cgi_main + from qmsk.irclogs import wsgi + + # create app + app = wsgi.Application() + + # run once + cgi_main.run(app) + + except : + # display error on stdout + error() + +if __name__ == '__main__' : + main() +