[FIX] http Internal Server Error when switching branches
authorAntony Lesuisse <al@openerp.com>
Tue, 29 Apr 2014 23:22:13 +0000 (01:22 +0200)
committerAntony Lesuisse <al@openerp.com>
Tue, 29 Apr 2014 23:22:13 +0000 (01:22 +0200)
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

index d70e535..c63a795 100644 (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: