[FIX] http.WebRequest: clear db/uid tracking on worker thread to avoid incorrect values during logging

Could happen when a worker thread is reused for another
database but does not go through all the dispatching levels,
e.g. for static resources served by werkzeug itself.

bzr revid: odo@openerp.com-20130228173530-bs5pun9o09iobosi
This commit is contained in:
Olivier Dony
2013-02-28 18:35:30 +01:00
parent b413e00d6a
commit ef10c2e3c8
+8
View File
@@ -93,6 +93,14 @@ class WebRequest(object):
if not self.session:
self.session = session.OpenERPSession()
self.httpsession[self.session_id] = self.session
# set db/uid trackers - they're cleaned up at the end of the
# WSGI dispatching phase in openerp.service.wsgi_server.application
if self.session._db:
threading.current_thread().dbname = self.session._db
if self.session._uid:
threading.current_thread().uid = self.session._uid
self.context = self.params.pop('context', {})
self.debug = self.params.pop('debug', False) is not False
# Determine self.lang