From d08ec8122899697fcbc7aa2868d9b1baadb24e2b Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 15 Mar 2008 02:25:46 +0000 Subject: [PATCH] queryset-refactor: The EmptyResultSet exception was declared in two places. Removed one of them. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7245 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 5 ++++- django/db/models/query_utils.py | 6 ------ django/db/models/sql/__init__.py | 3 ++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index 2e62b85602..bd2cf8dbaa 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -2,7 +2,7 @@ import warnings from django.db import connection, transaction from django.db.models.fields import DateField, FieldDoesNotExist -from django.db.models.query_utils import Q, EmptyResultSet, not_q +from django.db.models.query_utils import Q, not_q from django.db.models import signals, sql from django.dispatch import dispatcher from django.utils.datastructures import SortedDict @@ -12,6 +12,9 @@ from django.utils.datastructures import SortedDict CHUNK_SIZE = 100 ITER_CHUNK_SIZE = CHUNK_SIZE +# Pull into this namespace for backwards compatibility +EmptyResultSet = sql.EmptyResultSet + class _QuerySet(object): "Represents a lazy database lookup for a set of objects" def __init__(self, model=None, query=None): diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 003628ad94..6f1b860f21 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -9,12 +9,6 @@ from copy import deepcopy from django.utils import tree -class EmptyResultSet(Exception): - """ - Raised when a QuerySet cannot contain any data. - """ - pass - class QueryWrapper(object): """ A type that indicates the contents are an SQL fragment and the associate diff --git a/django/db/models/sql/__init__.py b/django/db/models/sql/__init__.py index ef8706c9df..7310982690 100644 --- a/django/db/models/sql/__init__.py +++ b/django/db/models/sql/__init__.py @@ -1,6 +1,7 @@ from query import * from subqueries import * from where import AND, OR +from datastructures import EmptyResultSet -__all__ = ['Query', 'AND', 'OR'] +__all__ = ['Query', 'AND', 'OR', 'EmptyResultSet']