diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-05-22 20:26:46 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-05-22 20:37:38 +0200 |
| commit | df7a65ac4ba36dd155e80b8bcfe607390976ad47 (patch) | |
| tree | 19c627b4782dc59b8ec384f1298670701e7cbb1e /django/db/models/sql/where.py | |
| parent | d5c7f9efc3702888b556cbf932116421b464e8b8 (diff) | |
Replaced 'next' testing by collections.Iterator testing.
The new construct is also Python 3 compatible (where 'next' has
been renamed to '__next__').
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 0bc3638b80..5515bc4f83 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -4,6 +4,7 @@ Code to manage the creation and SQL rendering of 'where' constraints. from __future__ import absolute_import +import collections import datetime from itertools import repeat @@ -49,7 +50,7 @@ class WhereNode(tree.Node): return obj, lookup_type, value = data - if hasattr(value, '__iter__') and hasattr(value, 'next'): + if isinstance(value, collections.Iterator): # Consume any generators immediately, so that we can determine # emptiness and transform any non-empty values correctly. value = list(value) |
