diff --git a/openerp/http.py b/openerp/http.py index 128a9526568..6daf9f01a24 100644 --- a/openerp/http.py +++ b/openerp/http.py @@ -1444,13 +1444,19 @@ class Root(object): try: with openerp.tools.mute_logger('openerp.sql_db'): ir_http = request.registry['ir.http'] - except (AttributeError, psycopg2.OperationalError): + except (AttributeError, psycopg2.OperationalError, psycopg2.ProgrammingError): # 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. + # the registry. That means either + # - the database probably does not exists anymore + # - the database is corrupted + # - the database version doesnt match the server version # Log the user out and fall back to nodb request.session.logout() - result = _dispatch_nodb() + # If requesting /web this will loop + if request.httprequest.path == '/web': + result = werkzeug.utils.redirect('/web/database/selector') + else: + result = _dispatch_nodb() else: result = ir_http._dispatch() openerp.modules.registry.RegistryManager.signal_caches_change(db)