From 9f3096d31f10fd08ee2b6015c48f35a7b4f3669f Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 16 Jan 2012 00:52:15 +0100 Subject: [PATCH 1/2] [FIX] missing import and remove unused vars. bzr revid: florent.xicluna@gmail.com-20120115235215-6dgoxyu270bsquba --- openerp/wsgi.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/openerp/wsgi.py b/openerp/wsgi.py index 193d30fb285..b2624e13612 100644 --- a/openerp/wsgi.py +++ b/openerp/wsgi.py @@ -30,12 +30,12 @@ import urllib import xmlrpclib import StringIO +import errno import logging import os import signal import sys import threading -import time import traceback import openerp @@ -261,7 +261,7 @@ def http_to_wsgi(http_dir): def wsgi_handler(environ, start_response): # Extract from the WSGI environment the necessary data. - scheme = environ['wsgi.url_scheme'] + # scheme = environ['wsgi.url_scheme'] headers = {} for key, value in environ.items(): @@ -426,7 +426,7 @@ def serve(): import werkzeug.serving httpd = werkzeug.serving.make_server(interface, port, application, threaded=True) logging.getLogger('wsgi').info('HTTP service (werkzeug) running on %s:%s', interface, port) - except ImportError, e: + except ImportError: import wsgiref.simple_server logging.getLogger('wsgi').warn('Werkzeug module unavailable, falling back to wsgiref.') httpd = wsgiref.simple_server.make_server(interface, port, application) @@ -457,7 +457,6 @@ arbiter_pid = None def on_starting(server): global arbiter_pid arbiter_pid = os.getpid() # TODO check if this is true even after replacing the executable - config = openerp.tools.config #openerp.tools.cache = kill_workers_cache openerp.netsvc.init_logger() openerp.osv.osv.start_object_proxy() @@ -499,7 +498,7 @@ def kill_workers(): except OSError, e: if e.errno == errno.ESRCH: # no such pid return - raise + raise class kill_workers_cache(openerp.tools.ormcache): def clear(self, dbname, *args, **kwargs): From f51dc9a0bd7a19a9e3a5dacba4ecd83a0c9e0edc Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 16 Jan 2012 00:52:35 +0100 Subject: [PATCH 2/2] [FIX] handle correctly the case when the PATH_INFO ends with a slash. bzr revid: florent.xicluna@gmail.com-20120115235235-kw4vvmp622q8843f --- openerp/wsgi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/wsgi.py b/openerp/wsgi.py index b2624e13612..09d9264966b 100644 --- a/openerp/wsgi.py +++ b/openerp/wsgi.py @@ -152,7 +152,7 @@ def wsgi_xmlrpc_1(environ, start_response): path = environ['PATH_INFO'][len(XML_RPC_PATH_1):] if path.startswith('/'): path = path[1:] - if path.endswith('/'): p = path[:-1] + if path.endswith('/'): path = path[:-1] path = path.split('/') # All routes are hard-coded. @@ -196,7 +196,7 @@ def wsgi_xmlrpc(environ, start_response): path = environ['PATH_INFO'][len(XML_RPC_PATH):] if path.startswith('/'): path = path[1:] - if path.endswith('/'): p = path[:-1] + if path.endswith('/'): path = path[:-1] path = path.split('/') # All routes are hard-coded.