1.1 --- a/WebStack/Adapters/ModPython.py Sun Feb 01 16:38:13 2004 +0000
1.2 +++ b/WebStack/Adapters/ModPython.py Sun Feb 01 16:38:34 2004 +0000
1.3 @@ -7,14 +7,19 @@
1.4 import WebStack.ModPython
1.5 from mod_python import apache
1.6
1.7 -def dispatch(request, resource):
1.8 +def dispatch(request, resource, debug=0):
1.9
1.10 - "Dispatch the given 'request' to the root application-specific 'resource'."
1.11 + """
1.12 + Dispatch the given 'request' to the root application-specific 'resource'.
1.13 + The optional 'debug' flag, if set to 1, causes tracebacks to be displayed in
1.14 + the browser.
1.15 + """
1.16
1.17 trans = WebStack.ModPython.Transaction(request)
1.18 +
1.19 + # NOTE: Resource pooling may be appropriate.
1.20 +
1.21 try:
1.22 - # NOTE: Resource pooling may be appropriate.
1.23 -
1.24 resource.respond(trans)
1.25 return apache.OK
1.26 except:
1.27 @@ -22,6 +27,9 @@
1.28 # NOTE: Error conditions should be investigated further, along with
1.29 # NOTE: other response states.
1.30
1.31 - return apache.INTERNAL_SERVER_ERROR
1.32 + if not debug:
1.33 + return apache.HTTP_INTERNAL_SERVER_ERROR
1.34 + else:
1.35 + raise
1.36
1.37 # vim: tabstop=4 expandtab shiftwidth=4