[FIX] core: disable werkzeug's merge_slashes
Werkzeug 1.0 adds a `merge_slashes` feature which calls rule.build() *during match*[0] (= during dispatch). However at this point our environment still contains an invalid / placeholder UID, so `display_name` / `name_get()` fails dramatically. One possibility would be to update the slugifying to not access the record (outside of the id) if the environment is not "proper", an other alternative is to just disable the feature since it seems to not have been necessary so far. The latter seems less hacky so do that for now, we can always swap the solution later if we need to. [0] https://github.com/pallets/werkzeug/blame/048cdfd9b969c0c3a133d7ff43b8ad1ad6a673ec/src/werkzeug/routing.py#L904
This commit is contained in:
@@ -269,7 +269,9 @@ class IrHttp(models.AbstractModel):
|
||||
for url, endpoint, routing in cls._generate_routing_rules(mods, converters=cls._get_converters()):
|
||||
xtra_keys = 'defaults subdomain build_only strict_slashes redirect_to alias host'.split()
|
||||
kw = {k: routing[k] for k in xtra_keys if k in routing}
|
||||
routing_map.add(werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods'], **kw))
|
||||
rule = werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods'], **kw)
|
||||
rule.merge_slashes = False
|
||||
routing_map.add(rule)
|
||||
cls._routing_map[key] = routing_map
|
||||
return cls._routing_map[key]
|
||||
|
||||
|
||||
+3
-1
@@ -1268,7 +1268,9 @@ class Root(object):
|
||||
_logger.info("Generating nondb routing")
|
||||
routing_map = werkzeug.routing.Map(strict_slashes=False, converters=None)
|
||||
for url, endpoint, routing in odoo.http._generate_routing_rules([''] + odoo.conf.server_wide_modules, True):
|
||||
routing_map.add(werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods']))
|
||||
rule = werkzeug.routing.Rule(url, endpoint=endpoint, methods=routing['methods'])
|
||||
rule.merge_slashes = False
|
||||
routing_map.add(rule)
|
||||
return routing_map
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
|
||||
Reference in New Issue
Block a user