From bd5b9412b33128857dcadcb226da17691d8a17ff Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 3 Feb 2006 22:29:15 +0000 Subject: [PATCH] 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 --- django/db/models/query.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index a8ab94d013..fa3969ecfc 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -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)