From c69d002acba2e74a10567f2371fdf329012998dc Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Thu, 17 Jan 2013 23:22:50 +0100 Subject: [PATCH] Fix unicode values read from json input on python 2.5 --- wsme/rest/json.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wsme/rest/json.py b/wsme/rest/json.py index 4c9ff3e..0bc29e6 100644 --- a/wsme/rest/json.py +++ b/wsme/rest/json.py @@ -164,6 +164,13 @@ def str_fromjson(datatype, value): return value.encode('utf8') +@fromjson.when_object(wsme.types.text) +def text_fromjson(datatype, value): + if value is not None and isinstance(value, wsme.types.bytes): + return wsme.types.text(value) + return value + + @fromjson.when_object(decimal.Decimal) def decimal_fromjson(datatype, value): if value is None: