summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Monniez <moc@odoo.com>2019-10-30 12:10:37 +0000
committerChristophe Monniez <moc@odoo.com>2019-10-30 12:35:23 +0000
commitb6ed34e134f868d7ccdfcb436592e0cc343fa3b5 (patch)
tree8bae7eb1b37fa9fbe71c386b59a655edd23b3101
parent855b29b6d0fc22b6d333bc470a04e60c84fffe73 (diff)
[FIX] ir_http: declare class attributes _routing_map and _rewrite_len
Actually, the two class attributes are only set when calling the routing_map method. As a consequence, when the url_for function in the http_routing module tries to access the _rewrite_len attribute, it may crashe. This problem arrise in the TestQwebProcessAtt from the website module when the test is run alone. It was hidden on the runbot because some missconfigured HttpCase tests were run at_install before TestQwebProcessAtt. In that particular case, the routing_map method is called and sets the attribute. With this commit, the _routing_map and _rewrite_len class attributes are set on the class at class declaration time.
-rw-r--r--odoo/addons/base/models/ir_http.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/odoo/addons/base/models/ir_http.py b/odoo/addons/base/models/ir_http.py
index 5418789b716..70730917ae2 100644
--- a/odoo/addons/base/models/ir_http.py
+++ b/odoo/addons/base/models/ir_http.py
@@ -82,6 +82,9 @@ class IrHttp(models.AbstractModel):
# Routing map
#------------------------------------------------------
+ _routing_map = {}
+ _rewrite_len = {}
+
@classmethod
def _get_converters(cls):
return {'model': ModelConverter, 'models': ModelsConverter, 'int': SignedIntConverter}
@@ -250,9 +253,6 @@ class IrHttp(models.AbstractModel):
@classmethod
def routing_map(cls, key=None):
- if not hasattr(cls, '_routing_map'):
- cls._routing_map = {}
- cls._rewrite_len = {}
if key not in cls._routing_map:
_logger.info("Generating routing map for key %s" % str(key))
installed = request.registry._init_modules | set(odoo.conf.server_wide_modules)