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@133: Dumps out a raw traceback of the current exception to stdout, call from except terom@133: """ terom@133: terom@133: import traceback, sys terom@133: terom@133: # HTTP headers terom@133: sys.stdout.write('Status: 500 Internal Server Error\r\n') terom@133: sys.stdout.write('Content-type: text/html\r\n') terom@133: sys.stdout.write('\r\n') terom@133: sys.stdout.write("""\ terom@133:
terom@133: An error occured, which was not logged, and will not be reported to anybody. It might be your fault, or it might be terom@133: the programmer's, but it's probably not mine. If you think you really care, you can try poking the administrator of terom@133: this site to see if they respond. terom@133:
terom@133:terom@133: If you do so, please include the following information: terom@133:
terom@133:%(traceback)sterom@133: terom@133: """ % dict(traceback=traceback.format_exc())) terom@133: terom@125: def main () : terom@16: """ terom@125: Build our wsgi.Application and run terom@7: """ terom@11: terom@11: try : terom@125: from qmsk.web import wsgi, cgi_main terom@46: import urls terom@16: terom@31: # create app terom@46: app = wsgi.Application(urls.mapper) 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: