From e73ad6a53da74452cf64de8607d14a7a0b73d7de Mon Sep 17 00:00:00 2001 From: "M.A Heshmatkhah" Date: Thu, 5 Jan 2023 10:13:42 +0000 Subject: [PATCH] [FIX] auth_oauth: fragment_to_query_string return Use the `fragment_to_query_string` decorator before the `route` decorator on a controller endpoint. Traceback when the endpoint is called as a `str` object is not a `Response` object. Since httpocalypse it is advised that all decorators used with http-type controllers return a Response. This makes it possible to decorate the endpoint in any order, even before `@route`. # Preferred @route(...) @fragment_to_query_string def endpoint(...): ... # This work @fragment_to_query_string @route(...) def endpoint(...): ... X-original-commit: 4a879cb4a395ad5ef47384937fcc383acdb3e431 Part-of: odoo/odoo#110034 --- addons/auth_oauth/controllers/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index d00e02915aa..38c7ca872de 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -12,7 +12,7 @@ from werkzeug.exceptions import BadRequest from odoo import api, http, SUPERUSER_ID, _ from odoo.exceptions import AccessDenied -from odoo.http import request +from odoo.http import request, Response from odoo import registry as registry_get from odoo.addons.auth_signup.controllers.main import AuthSignupHome as Home @@ -30,7 +30,7 @@ def fragment_to_query_string(func): def wrapper(self, *a, **kw): kw.pop('debug', False) if not kw: - return """""" + """) return func(self, *a, **kw) return wrapper