summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-08 03:32:16 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-03-08 03:32:16 +0000
commitcd99c62e2de8701ffd940d86da8e41798c10007d (patch)
treeb6ac74ce1b2951aff49e7c5ddd0a4968f788bf12 /django/db/models/sql
parentf1ada99997de72fdd3f765ffa11fa4d1d9f438f9 (diff)
Fixed #10432 -- Handle all kinds of iterators in queryset filters.
Only consumes the iterators once and works with Python 2.3. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/where.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index a711103485..ec0545ca5b 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -47,6 +47,10 @@ class WhereNode(tree.Node):
return
obj, lookup_type, value = data
+ if hasattr(value, '__iter__') and hasattr(value, 'next'):
+ # Consume any generators immediately, so that we can determine
+ # emptiness and transform any non-empty values correctly.
+ value = list(value)
if hasattr(obj, "process"):
try:
obj, params = obj.process(lookup_type, value)