X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ModPython.py;h=1a5b43e6c25747ca1d1375f90c0aff0d6dacc08a;hb=5d1186b318a037732efa0c59c9921388bafd086f;hp=e5f1174dc10cba2339359e1d5662be4dc3036634;hpb=24d16d18acab3da7bccc3e09df4927e9cf2d3246;p=plcapi.git diff --git a/ModPython.py b/ModPython.py index e5f1174..1a5b43e 100644 --- a/ModPython.py +++ b/ModPython.py @@ -5,7 +5,6 @@ # Mark Huang # # Copyright (C) 2004-2006 The Trustees of Princeton University -# $Id$ # import sys @@ -45,15 +44,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-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