Skip to content

Commit

Permalink
[FIX] http jump to database selector on broken databases
Browse files Browse the repository at this point in the history
  • Loading branch information
antonylesuisse committed Aug 1, 2015
1 parent a88c520 commit 4b330f3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions openerp/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -1444,13 +1444,19 @@ def _dispatch_nodb():
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)
Expand Down

0 comments on commit 4b330f3

Please sign in to comment.