summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:42:51 +0000
commit5ce2e6c2c827cf877f73bf0e42e6afb7e6a71ccf (patch)
tree8c8c2fb8329e2db7dbfcf2c47026a11ff079e5c5 /django/utils
parentea9cd5421382c047e2cc140bd6736b54ba660793 (diff)
queryset-refactor: Merged to [6220]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6337 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/itercompat.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/utils/itercompat.py b/django/utils/itercompat.py
index 0de1b6cbe2..3742d6c5d8 100644
--- a/django/utils/itercompat.py
+++ b/django/utils/itercompat.py
@@ -57,3 +57,13 @@ else:
tee = compat_tee
if hasattr(itertools, 'groupby'):
groupby = itertools.groupby
+
+def is_iterable(x):
+ "A implementation independent way of checking for iterables"
+ try:
+ iter(x)
+ except TypeError:
+ return False
+ else:
+ return True
+