X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ModPython.py;h=0d630d7cf1b87f0185d7b71fd2a0e94925d0dafb;hb=e84eace67a0681310ca4cb7b9d6da7f455863ac1;hp=79d8fde1c49f887e07f9170dfb3d74af6de5b911;hpb=711d4c0696c03c1661ca45e0a3e8c8577e084703;p=plcapi.git diff --git a/ModPython.py b/ModPython.py index 79d8fde..0d630d7 100644 --- a/ModPython.py +++ b/ModPython.py @@ -5,7 +5,8 @@ # Mark Huang # # Copyright (C) 2004-2006 The Trustees of Princeton University -# $Id: ModPython.py,v 1.1 2006/09/06 15:33:59 mlhuang Exp $ +# $Id$ +# $URL$ # import sys @@ -45,16 +46,18 @@ def handler(req): # Handle request response = api.handle(remote_addr, request) + # Shut down database connection, otherwise up to MaxClients DB + # connections will remain open. + api.db.close() + # Write response - req.content_type = "text/xml" - req.headers_out.add("Content-type", "text/xml") - req.headers_out.add("Content-length", str(len(response))) + req.content_type = "text/xml; charset=" + api.encoding req.send_http_header() req.write(response) return apache.OK - except: + except Exception, err: # Log error in /var/log/httpd/(ssl_)?error_log - print >> log, traceback.format_exc() + print >> log, err, traceback.format_exc() return apache.HTTP_INTERNAL_SERVER_ERROR