[IMP] core, bus: future werkzeug compatibility fixes
- `Response.charset` is deprecated since 2.3, `Response.set_cookie` accesses the currently-extent internal `_charset` directly until this too gets removed in Werkzeug 3.0. Add a `_charset` to `FutureResponse` so this does not crash. - Bytes response headers are deprecated since 2.3, and will get removed in 3.0, passing bytes in websocket is completely unnecessary happenstance which is trivially fixed. closes odoo/odoo#137145 X-original-commit: 66e3040d4ad9e03aabefebd4799f699ad30fca45 Signed-off-by: Julien Castiaux (juc) <juc@odoo.com> Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -862,7 +862,7 @@ class WebsocketConnectionHandler:
|
||||
return Response(status=101, headers={
|
||||
'Upgrade': 'websocket',
|
||||
'Connection': 'Upgrade',
|
||||
'Sec-WebSocket-Accept': accept_header,
|
||||
'Sec-WebSocket-Accept': accept_header.decode(),
|
||||
})
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1274,6 +1274,10 @@ class FutureResponse:
|
||||
def __init__(self):
|
||||
self.headers = werkzeug.datastructures.Headers()
|
||||
|
||||
@property
|
||||
def _charset(self):
|
||||
return self.charset
|
||||
|
||||
@functools.wraps(werkzeug.Response.set_cookie)
|
||||
def set_cookie(self, key, value='', max_age=None, expires=-1, path='/', domain=None, secure=False, httponly=False, samesite=None, cookie_type='required'):
|
||||
if expires == -1: # not forced value -> default value -> 1 year
|
||||
|
||||
Reference in New Issue
Block a user