diff options
| author | Julien Castiaux <juc@odoo.com> | 2025-01-14 16:04:22 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2025-01-20 20:19:04 +0000 |
| commit | b2d709bdd42573c8e82b9e4e85193fa0def4f18d (patch) | |
| tree | 9ef8be87eee891fee30786e8636bd05071bb400a /odoo/http.py | |
| parent | a9359dd056c5f4cfea0e575531e7d7e61e2e4b8b (diff) | |
[FIX] core: http.route accepts any Iterable, not only list
The docstring of `@route` states that it accepts any iterable for the
`route` and `methods` argument, but several places in the source code
wrongly expected a list, and broke if it was a tuple.
closes odoo/odoo#193869
X-original-commit: a97a2232e1dec1a8a318df562d8e5b19779a33d9
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Diffstat (limited to 'odoo/http.py')
| -rw-r--r-- | odoo/http.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/odoo/http.py b/odoo/http.py index 869c35dd0db..8ad3f6b3ae4 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -711,7 +711,7 @@ def route(route=None, **routing): # Sanitize the routing assert routing.get('type', 'http') in _dispatchers.keys() if route: - routing['routes'] = route if isinstance(route, list) else [route] + routing['routes'] = [route] if isinstance(route, str) else route wrong = routing.pop('method', None) if wrong is not None: _logger.warning("%s defined with invalid routing parameter 'method', assuming 'methods'", fname) @@ -2271,7 +2271,7 @@ class Application: for url, endpoint in _generate_routing_rules([''] + odoo.conf.server_wide_modules, nodb_only=True): routing = submap(endpoint.routing, ROUTING_KEYS) if routing['methods'] is not None and 'OPTIONS' not in routing['methods']: - routing['methods'] = routing['methods'] + ['OPTIONS'] + routing['methods'] = [*routing['methods'], 'OPTIONS'] rule = werkzeug.routing.Rule(url, endpoint=endpoint, **routing) rule.merge_slashes = False nodb_routing_map.add(rule) |
