- else:
- api.environ = environ
- content_type = 'text/xml'
- ip = environ.get('REMOTE_ADDR')
- port = environ.get('REMOTE_PORT')
- output = api.handle((ip,port),environ.get('wsgi.input').read())
- # Shut down database connection, otherwise up to MaxClients DB
- # connections will remain open.
- api.db.close()
+ else:
+ api.environ = environ
+ content_type = 'text/xml'
+ ip = environ.get('REMOTE_ADDR')
+ port = environ.get('REMOTE_PORT')
+ output = api.handle((ip,port), environ.get('wsgi.input').read())
+ # Shut down database connection, otherwise up to MaxClients DB
+ # connections will remain open.
+ api.db.close()
+ except Exception, err:
+ status = '500 Internal Server Error'
+ content_type = 'text/html'
+ output = 'Internal Server Error'
+ print >> log, err, traceback.format_exc()