From ce897b35699662968754450db3440a1bb5f833e8 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 14 Sep 2014 11:58:16 -0500 Subject: [PATCH] added custom represent to GoogleDatastoreAdapter, thanks Alan --- VERSION | 2 +- gluon/dal.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 24370613..f52853a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.9.9-stable+timestamp.2014.09.13.18.54.57 +Version 2.9.9-stable+timestamp.2014.09.14.11.58.10 diff --git a/gluon/dal.py b/gluon/dal.py index 09a41a03..a37923ae 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5053,6 +5053,17 @@ class GoogleDatastoreAdapter(NoSQLAdapter): def parse_id(self, value, field_type): return value + def represent(self, obj, fieldtype): + if fieldtype == "json": + if have_serializers: + return serializers.json(obj) + elif simplejson: + return simplejson.dumps(obj) + else: + raise Exception("Could not dump json object (missing json library)") + else: + return NoSQLAdapter.represent(self, obj, fieldtype) + def create_table(self, table, migrate=True, fake_migrate=False, polymodel=None): myfields = {} for field in table: