[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
This commit is contained in:
committed by
Julien Castiaux
parent
7b447e4139
commit
e73ad6a53d
@@ -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 """<html><head><script>
|
||||
return Response("""<html><head><script>
|
||||
var l = window.location;
|
||||
var q = l.hash.substring(1);
|
||||
var r = l.pathname + l.search;
|
||||
@@ -42,7 +42,7 @@ def fragment_to_query_string(func):
|
||||
r = '/';
|
||||
}
|
||||
window.location = r;
|
||||
</script></head><body></body></html>"""
|
||||
</script></head><body></body></html>""")
|
||||
return func(self, *a, **kw)
|
||||
return wrapper
|
||||
|
||||
|
||||
Reference in New Issue
Block a user