magic-removal: Changed QuerySet.in_bulk() to check for tuple or list, because it was accepting strings, which are iterable.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-03 22:29:15 +00:00
parent c060e85c8d
commit bd5b9412b3
1 changed files with 1 additions and 4 deletions

View File

@ -195,10 +195,7 @@ class QuerySet(object):
##################################################
def in_bulk(self, id_list):
try:
iter(id_list)
except TypeError:
assert False, "in_bulk() must be provided with a list of IDs."
assert isinstance(id_list, (tuple, list)), "in_bulk() must be provided with a list of IDs."
id_list = list(id_list)
assert id_list != [], "in_bulk() cannot be passed an empty ID list."
return self._clone(klass=InBulkQuerySet, _id_list=id_list)