NDB accepts set, list and tuple, thanks Quint
This commit is contained in:
@@ -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
|
||||||
|
|||||||
+5
-4
@@ -4949,11 +4949,12 @@ class GoogleDatastoreAdapter(NoSQLAdapter):
|
|||||||
def BELONGS(self,first,second=None):
|
def BELONGS(self,first,second=None):
|
||||||
if not isinstance(second,(list, tuple, set)):
|
if not isinstance(second,(list, tuple, set)):
|
||||||
raise SyntaxError("Not supported")
|
raise SyntaxError("Not supported")
|
||||||
if first.type != 'id':
|
if not self.use_ndb:
|
||||||
return [GAEF(first.name,'in',self.represent(second,first.type),lambda a,b:a in b)]
|
if isinstance(second,set):
|
||||||
else:
|
second = list(second)
|
||||||
|
if first.type == 'id':
|
||||||
second = [Key.from_path(first._tablename, int(i)) for i in second]
|
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):
|
def CONTAINS(self,first,second,case_sensitive=False):
|
||||||
# silently ignoring: GAE can only do case sensitive matches!
|
# silently ignoring: GAE can only do case sensitive matches!
|
||||||
|
|||||||
Reference in New Issue
Block a user