[FIX] *: replace werkzeug's Response by odoo's Response

*: base, http_routing, mass_mailing, web, web_editor, website_slides

In some situations `werkzeug.wrappers.Response` are used instead of
`odoo.http.Reponse` that extends it.
This is a problem because since [1] the calls to `set_cookie` expect it
to accept the `cookie_type` parameter, which is not the case in the base
werkzeug implementation.

This commit replaces the `werkzeug.wrappers.Response` by
`odoo.http.Response`.

[1]: https://github.com/odoo/odoo/commit/2cbda6c98ee947cea1d06c09880eee8c758304a8

closes odoo/odoo#112827

X-original-commit: 28da08292b7028575e628c5ad846fc05d30498f2
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
Benoit Socias
2023-02-16 09:01:07 +01:00
parent c29d59e41f
commit fb9efde4f3
9 changed files with 21 additions and 25 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ from odoo.addons.website.controllers.main import QueryURL
from odoo.addons.website.models.ir_http import sitemap_qs2dom
from odoo.addons.website_profile.controllers.main import WebsiteProfile
from odoo.exceptions import AccessError, ValidationError, UserError, MissingError
from odoo.http import request
from odoo.http import request, Response
from odoo.osv import expression
from odoo.tools import email_split
@@ -801,7 +801,7 @@ class WebsiteSlides(WebsiteProfile):
@http.route('''/slides/slide/<model("slide.slide"):slide>/pdf_content''',
type='http', auth="public", website=True, sitemap=False)
def slide_get_pdf_content(self, slide):
response = werkzeug.wrappers.Response()
response = Response()
response.data = slide.binary_content and base64.b64decode(slide.binary_content) or b''
response.mimetype = 'application/pdf'
return response