From d1a971fb618be722cceda0737767edda2c5622e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 30 May 2017 22:07:46 +0200 Subject: [PATCH] Decode username before logging it The username of request authorisation is bytes encoded in UTF-8. The logging module tries to decode it as ASCII by default. issue6517 review34991002 --- trytond/protocols/dispatcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py index 055f84c8f4..545f3c00a3 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -144,8 +144,9 @@ def _dispatch(request, pool, *args, **kwargs): % (method, obj)) log_message = '%s.%s(*%s, **%s) from %s@%s/%s' - log_args = (obj, method, args, kwargs, - request.authorization.username, request.remote_addr, request.path) + username = request.authorization.username.decode('utf-8') + log_args = ( + obj, method, args, kwargs, username, request.remote_addr, request.path) logger.info(log_message, *log_args) user = request.user_id