terom@6: #!/usr/bin/python2.5 terom@6: terom@7: """ terom@125: CGI mode using qmsk.web.cgi terom@7: """ terom@6: terom@133: def error () : terom@133: """ terom@134: Dumps out a raw traceback of the current exception to stdout, call from except. terom@133: terom@134: Used for low-level ImportError's terom@134: """ terom@133: terom@140: import sys terom@140: terom@134: # if this import fails, we're doomed terom@140: from qmsk.irclogs import error terom@134: terom@134: # format info terom@134: status, content_type, body = error.build_error() terom@134: terom@134: # HTTP headers+body terom@134: sys.stdout.write('Status: %s\r\n' % status) terom@134: sys.stdout.write('Content-type: %s\r\n' % content_type) terom@133: sys.stdout.write('\r\n') terom@134: sys.stdout.write(body) terom@133: terom@125: def main () : terom@16: """ terom@125: Build our wsgi.Application and run terom@7: """ terom@11: terom@11: try : terom@134: from qmsk.web import cgi_main terom@140: from qmsk.irclogs import wsgi terom@16: terom@31: # create app terom@134: app = wsgi.Application() terom@16: terom@16: # run once terom@125: cgi_main.run(app) terom@11: terom@11: except : terom@125: # display error on stdout terom@133: error() terom@7: terom@7: if __name__ == '__main__' : terom@125: main() terom@125: