Anonymous avatar Anonymous committed 7eb46de

fixed handling of __in=[] (empty list). now returns no results in that case

Comments (0)

Files changed (1)

     def __init__(self, compiler, fields):
         super(GAEQuery, self).__init__(compiler, fields)
         self.inequality_field = None
-        self.pk_filters = []
+        self.pk_filters = None
         pks_only = False
         if len(fields) == 1 and fields[0].primary_key:
             pks_only = True
     @safe_call
     def fetch(self, low_mark, high_mark):
         query = self.gae_query
-        if self.pk_filters:
+        if self.pk_filters is not None:
             results = self.get_matching_pk(low_mark, high_mark)
         else:
             if high_mark is None:
 
     @safe_call
     def count(self, limit=None):
-        if self.pk_filters:
+        if self.pk_filters is not None:
             return len(self.get_matching_pk(0, limit))
         return self.gae_query.Count(limit)
 
     @safe_call
     def delete(self):
-        if self.pk_filters:
+        if self.pk_filters is not None:
             keys = [key for key in self.pk_filters if key is not None]
         else:
             keys = self.fetch()
-        Delete(keys)
+        if keys:
+            Delete(keys)
 
     @safe_call
     def order_by(self, ordering):
             column = '__key__'
             db_table = self.query.get_meta().db_table
             if lookup_type in ('exact', 'in'):
-                if self.pk_filters:
+                if self.pk_filters is not None:
                     raise DatabaseError("You can't apply multiple AND filters "
                                         "on the primary key. "
                                         "Did you mean __in=[...]?")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.