git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/pycurl' into planetlab-4_0-branch
[plcapi.git]
/
ModPython.py
diff --git
a/ModPython.py
b/ModPython.py
index
e5f1174
..
a1b2ab2
100644
(file)
--- a/
ModPython.py
+++ b/
ModPython.py
@@
-5,7
+5,7
@@
# Mark Huang <mlhuang@cs.princeton.edu>
#
# Copyright (C) 2004-2006 The Trustees of Princeton University
# Mark Huang <mlhuang@cs.princeton.edu>
#
# Copyright (C) 2004-2006 The Trustees of Princeton University
-# $Id$
+# $Id
: ModPython.py,v 1.5 2007/02/12 18:42:49 mlhuang Exp
$
#
import sys
#
import sys
@@
-45,15
+45,18
@@
def handler(req):
# Handle request
response = api.handle(remote_addr, request)
# 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
# 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
req.send_http_header()
req.write(response)
return apache.OK
- except:
+ except
Exception, err
:
# Log error in /var/log/httpd/(ssl_)?error_log
# 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
return apache.HTTP_INTERNAL_SERVER_ERROR