From c9873fb0b49024485c57fc48fde341d4602076a1 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Wed, 30 Apr 2014 01:22:13 +0200 Subject: [PATCH] [FIX] http Internal Server Error when switching branches When the source code doesnt match ir.models of the current session database, openerp is unable to build a registry, we now clear the session instead of issuing an http 500 error. bzr revid: al@openerp.com-20140429232213-omao31x6fdxwg2ov --- openerp/http.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openerp/http.py b/openerp/http.py index d70e5358ed9..c63a795b6a7 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -1224,10 +1224,11 @@ class Root(object): try: with openerp.tools.mute_logger('openerp.sql_db'): ir_http = request.registry['ir.http'] - except psycopg2.OperationalError: - # psycopg2 error. At this point, that means the - # database probably does not exists anymore. Log the - # user out and fall back to nodb + except (AttributeError, psycopg2.OperationalError): + # psycopg2 error or attribute error while constructing + # the registry. That means the database probably does + # not exists anymore or the code doesnt match the db. + # Log the user out and fall back to nodb request.session.logout() result = _dispatch_nodb() else: