From b15211064df3b74124bb08aa7d9172e0ddcec236 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 25 Mar 2013 15:25:29 -0500 Subject: [PATCH] fixed NoSQL Json, thanks Alan --- VERSION | 2 +- gluon/dal.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index f54b6eb16..b037f25c5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.5-stable+timestamp.2013.03.21.15.09.50 +Version 2.4.5-stable+timestamp.2013.03.25.15.24.28 diff --git a/gluon/dal.py b/gluon/dal.py index 2b3716b0f..91e7192a7 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -4364,13 +4364,14 @@ def represent(self, obj, fieldtype): elif fieldtype == 'blob': pass elif fieldtype == 'json': - obj = self.to_unicode(obj) - if have_serializers: - obj = serializers.loads_json(obj) - elif simplejson: - obj = simplejson.loads(obj) - else: - raise RuntimeError("missing simplejson") + if isinstance(obj, basestring): + obj = self.to_unicode(obj) + if have_serializers: + obj = serializers.loads_json(obj) + elif simplejson: + obj = simplejson.loads(obj) + else: + raise RuntimeError("missing simplejson") elif is_string and field_is_type('list:string'): return map(self.to_unicode,obj) elif is_list: