diff -r 088aa2da1340 -r fbccc1648d79 index.cgi --- a/index.cgi Mon Feb 16 01:03:23 2009 +0200 +++ b/index.cgi Mon Feb 16 02:09:14 2009 +0200 @@ -6,30 +6,22 @@ def error () : """ - Dumps out a raw traceback of the current exception to stdout, call from except - """ + Dumps out a raw traceback of the current exception to stdout, call from except. - import traceback, sys + Used for low-level ImportError's + """ - # HTTP headers - sys.stdout.write('Status: 500 Internal Server Error\r\n') - sys.stdout.write('Content-type: text/html\r\n') + # if this import fails, we're doomed + import sys, 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("""\ -500 Internal Server Error -

Oops!

-

- An error occured, which was not logged, and will not be reported to anybody. It might be your fault, or it might be - the programmer's, but it's probably not mine. If you think you really care, you can try poking the administrator of - this site to see if they respond. -

-

- If you do so, please include the following information: -

-

Details:

-
%(traceback)s
- -""" % dict(traceback=traceback.format_exc())) + sys.stdout.write(body) def main () : """ @@ -37,11 +29,11 @@ """ try : - from qmsk.web import wsgi, cgi_main - import urls + from qmsk.web import cgi_main + import wsgi # create app - app = wsgi.Application(urls.mapper) + app = wsgi.Application() # run once cgi_main.run(app)