[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
This commit is contained in:
Antony Lesuisse 2014-04-30 01:22:13 +02:00
parent f38387820d
commit c9873fb0b4
1 changed files with 5 additions and 4 deletions

View File

@ -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: