diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-03-26 18:07:20 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2020-03-26 18:12:47 +0000 |
| commit | 26c4de2f18be2b4e944ee255236d9a5a1710d94c (patch) | |
| tree | 80e8ccc73369b1d825ee4161f8c32cb57a1048b5 /addons | |
| parent | a65d27cce98c1b0d303eeaf8f066fe4983afc7a8 (diff) | |
[IMP] http_routing: use cached code from lang
In case of short controller that don't use qweb template, we don't need
anyhting else that this url code that don't change frequently.
It make only sense for model like lang, website, ... that will not change
frequently. And are called on each call by the dispatcher.
In case of a website page, we will btw browse lang later, but in case of
small controller like /favicon.ico, or page without qweb, ... we can just
use the same from last query.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/http_routing/models/ir_http.py | 2 | ||||
| -rw-r--r-- | addons/website/tests/test_performance.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/http_routing/models/ir_http.py b/addons/http_routing/models/ir_http.py index 5469310228f..c0fd4a46a19 100644 --- a/addons/http_routing/models/ir_http.py +++ b/addons/http_routing/models/ir_http.py @@ -411,7 +411,7 @@ class IrHttp(models.AbstractModel): lang = preferred_lang or cls._get_default_lang() request.lang = lang - context['lang'] = lang.code + context['lang'] = lang._get_cached('code') # bind modified context request.context = context diff --git a/addons/website/tests/test_performance.py b/addons/website/tests/test_performance.py index 0cbc7ce214d..2e02135116a 100644 --- a/addons/website/tests/test_performance.py +++ b/addons/website/tests/test_performance.py @@ -95,7 +95,7 @@ class TestWebsitePerformance(UtilPerf): def test_30_perf_sql_queries_page_no_layout(self): # website.page with no call to layout templates self.page.arch = '<div>I am a blank page</div>' - self.assertEqual(self._get_url_hot_query(self.page.url), 10) + self.assertEqual(self._get_url_hot_query(self.page.url), 9) def test_40_perf_sql_queries_page_multi_level_menu(self): # menu structure should not impact SQL requests |
