X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=apache%2Fplc.wsgi;h=c37d3695b5d59b93066420aa98384809b76ee24d;hb=refs%2Fheads%2Fremove-xmlrpc;hp=a720088915a7d950ad86a98f9a0ee81670bab932;hpb=6ce6589692d760ba10b47af0d24651c3481e389a;p=plcapi.git diff --git a/apache/plc.wsgi b/apache/plc.wsgi index a720088..c37d369 100644 --- a/apache/plc.wsgi +++ b/apache/plc.wsgi @@ -12,16 +12,12 @@ import traceback from PLC.Debug import log from PLC.API import PLCAPI -api = PLCAPI() - -# recipe from this page -# http://code.google.com/p/modwsgi/wiki/DebuggingTechniques -# let ErrorMiddleware deal with exceptions def application(environ, start_response): - status = '200 OK' - if environ.get('REQUEST_METHOD') != 'POST': - content_type = 'text/html' - output = """ + try: + status = '200 OK' + if environ.get('REQUEST_METHOD') != 'POST': + content_type = 'text/html' + output = """
Please use XML-RPC or SOAP to access the PLCAPI.
""" - 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: + # Thomas Dreibholz