[FIX] website: fix semantics of MockRequest

We should push the request object on the request stack only in the
__enter__ method, in order to be symmetrical with the __exit__ method.

closes odoo/odoo#53613

X-original-commit: 30e94d305f9cffa816ddc213e0b9329c0263c145
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
This commit is contained in:
Paul Morelle
2020-06-24 16:06:11 +00:00
parent 5e888f8a6c
commit f463983cf9
+1 -1
View File
@@ -116,9 +116,9 @@ class MockRequest(object):
},
'website': kw.get('website'),
})
odoo.http._request_stack.push(self.request)
def __enter__(self):
odoo.http._request_stack.push(self.request)
return self.request
def __exit__(self, exc_type, exc_value, traceback):