[FIX] http: nodb fallback in case of connection error

When calling a `auth=none` route with a non-existing DB name, the server
redirects to `/web/database/selector`. Such a route can be called
without database, therefore it is expected to work if the database
doesn't exist as well.

Before the HTTP refactoring, the fallback was `_dispatch_nodb` [1]. We
roll back to the same behavior since there is no good reason to redirect
to `/web/database/selector`.

Commits 4b330f3173 and de4e67dcc529163 are reintroduced as well.

[1] https://github.com/odoo/odoo/blob/b3199e949ae70307e8181ba0d6237871d6d07af7/odoo/http.py#L1529

closes odoo/odoo#104174

X-original-commit: 1565e85890f1d14e067edd1c198c7199ab536307
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Olivier Dony <odo@odoo.com>
This commit is contained in:
Nicolas Martinelli
2022-10-26 16:07:31 +02:00
parent c18ce5d535
commit 5c80ca4d1d
+5 -1
View File
@@ -1525,7 +1525,11 @@ class Request:
self.db = None
self.session.db = None
root.session_store.save(self.session)
return self.redirect('/web/database/selector')
if request.httprequest.path == '/web':
# Internal Server Error
raise
else:
return self._serve_nodb()
with contextlib.closing(self.registry.cursor()) as cr:
self.env = odoo.api.Environment(cr, self.session.uid, self.session.context)