From df2f9e7119b736bbd2337096fe6fe524e32b4c70 Mon Sep 17 00:00:00 2001 From: Massimo Date: Tue, 19 Nov 2013 17:07:19 -0600 Subject: [PATCH] NDB accepts set, list and tuple, thanks Quint --- VERSION | 2 +- gluon/dal.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 76240630..946a9e61 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.18.15.40.40 +Version 2.7.4-stable+timestamp.2013.11.19.17.05.52 diff --git a/gluon/dal.py b/gluon/dal.py index 413ccff5..2228987b 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -4949,11 +4949,12 @@ class GoogleDatastoreAdapter(NoSQLAdapter): def BELONGS(self,first,second=None): if not isinstance(second,(list, tuple, set)): raise SyntaxError("Not supported") - if first.type != 'id': - return [GAEF(first.name,'in',self.represent(second,first.type),lambda a,b:a in b)] - else: + if not self.use_ndb: + if isinstance(second,set): + second = list(second) + if first.type == 'id': second = [Key.from_path(first._tablename, int(i)) for i in second] - return [GAEF(first.name,'in',second,lambda a,b:a in b)] + return [GAEF(first.name,'in',second,lambda a,b:a in b)] def CONTAINS(self,first,second,case_sensitive=False): # silently ignoring: GAE can only do case sensitive matches!