From 4ea96c04688a017c846b9c01ab68b8df6be866a9 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 3 Dec 2007 03:31:26 +0000 Subject: [PATCH] queryset-refactor: Changed execute_sql() to not return an iterator in the non-MULTI cases when there is an empty result set. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6860 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/query.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 907903dc90..e921687c99 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -988,7 +988,10 @@ class Query(object): try: sql, params = self.as_sql() except EmptyResultSet: - raise StopIteration + if result_type == MULTI: + raise StopIteration + else: + return cursor = self.connection.cursor() cursor.execute(sql, params)