From 604795d6fc1d38bf00ac2a4752e76fba9fef827b Mon Sep 17 00:00:00 2001 From: gi0baro Date: Fri, 25 Oct 2013 10:40:56 +0200 Subject: [PATCH] Fixing mongodb binary repr: if value is not a basestring we got type Exception in converting to Binary --- gluon/dal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gluon/dal.py b/gluon/dal.py index 01445358..f1f7eae1 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5449,6 +5449,8 @@ class MongoDBAdapter(NoSQLAdapter): elif fieldtype == "blob": from bson import Binary if not isinstance(value, Binary): + if not isinstance(value, basestring): + return Binary(str(value)) return Binary(value) return value elif (isinstance(fieldtype, basestring) and