From 29a2f28d8f07596ffb9ddb05dcfdf8748d905fc9 Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Thu, 5 Sep 2013 01:59:22 +0530 Subject: [PATCH] Check if session exist when logging out. issue3344 review1040002 --- trytond/security.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trytond/security.py b/trytond/security.py index 75844bad83..7d3e85bc32 100644 --- a/trytond/security.py +++ b/trytond/security.py @@ -35,11 +35,14 @@ def logout(dbname, user, session): with Transaction().start(dbname, 0) as transaction: pool = _get_pool(dbname) Session = pool.get('ir.session') - session, = Session.search([ + sessions = Session.search([ ('key', '=', session), ]) + if not sessions: + return + session, = sessions name = session.create_uid.login - Session.delete([session]) + Session.delete(sessions) transaction.cursor.commit() return name