From 4c84341b8bc14cd19a4e2c2df4c13b95ff7eeb05 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 7 Feb 2017 17:46:08 +0100 Subject: py3: send Decimal number as string instead of base64 encoded value for Decimal only from client to server direction uses __base64__ notation. Server replies with pure string for Decimal data, and also server is able to parse string and create decimal values where needed. without this we need ugly py3 code: - return {'__base64__': base64.b64encode(str(val))} + return {'__base64__': base64.b64encode( + str(val).encode('ascii')).decode('ascii')} https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Jan Cholasta --- ipalib/rpc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipalib') diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 356ec4229..7d9f6ec7e 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -308,7 +308,7 @@ def json_encode_binary(val, version): encoded = encoded.decode('ascii') return {'__base64__': encoded} elif isinstance(val, Decimal): - return {'__base64__': base64.b64encode(str(val))} + return unicode(val) elif isinstance(val, DN): return str(val) elif isinstance(val, datetime.datetime): -- cgit