summaryrefslogtreecommitdiff
path: root/odoo/service/wsgi_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'odoo/service/wsgi_server.py')
-rw-r--r--odoo/service/wsgi_server.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/odoo/service/wsgi_server.py b/odoo/service/wsgi_server.py
index 95276f336b1..af5ae574187 100644
--- a/odoo/service/wsgi_server.py
+++ b/odoo/service/wsgi_server.py
@@ -88,6 +88,17 @@ def xmlrpc_handle_exception_string(e):
return xmlrpclib.dumps(fault, allow_none=None, encoding=None)
+def _patch_xmlrpc_marshaller():
+ # By default, in xmlrpc, bytes are converted to xmlrpclib.Binary object.
+ # Historically, odoo is sending binary as base64 string.
+ # In python 3, base64.b64{de,en}code() methods now works on bytes.
+ # Convert them to str to have a consistent behavior between python 2 and python 3.
+ # TODO? Create a `/xmlrpc/3` route prefix that respect the standard and uses xmlrpclib.Binary.
+ def dump_bytes(marshaller, value, write):
+ marshaller.dump_unicode(odoo.tools.ustr(value), write)
+
+ xmlrpclib.Marshaller.dispatch[bytes] = dump_bytes
+
def wsgi_xmlrpc(environ, start_response):
""" Two routes are available for XML-RPC