From 404472d5e2276c90c1dedef1320b072bbb2478af Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 22 Aug 2012 17:34:54 +0200 Subject: [PATCH] [FIX] res_users: improve behavior when user record is locked during login Avoid logging an ugly and frightening traceback, plus properly rollback the failed transaction before continuing. bzr revid: odo@openerp.com-20120822153454-omo4jpkhy2u31tmo --- bin/addons/base/res/res_user.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index c683416..01f8e5d 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -453,14 +453,14 @@ class users(osv.osv): cr.execute("""SELECT id from res_users WHERE login=%s AND password=%s AND active FOR UPDATE NOWAIT""", - (tools.ustr(login), tools.ustr(password))) + (tools.ustr(login), tools.ustr(password)), log_exceptions=False) cr.execute('UPDATE res_users SET date=now() WHERE login=%s AND password=%s AND active RETURNING id', (tools.ustr(login), tools.ustr(password))) except Exception: # Failing to acquire the lock on the res_users row probably means - # another request is holding it. No big deal, we don't want to - # prevent/delay login in that case. It will also have been logged - # as a SQL error, if anyone cares. + # another request is holding it - no big deal, we skip the update + # for this time, and let the user login anyway. + cr.rollback() cr.execute("""SELECT id from res_users WHERE login=%s AND password=%s AND active""", -- 1.7.10.4