summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-15 02:25:46 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-15 02:25:46 +0000
commitd08ec8122899697fcbc7aa2868d9b1baadb24e2b (patch)
tree1a18e6c155321b16137f62b04dbce9d8d1bebda8
parenta81813fb4aec2e25850780c3846ad9743bf460ed (diff)
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
-rw-r--r--django/db/models/query.py5
-rw-r--r--django/db/models/query_utils.py6
-rw-r--r--django/db/models/sql/__init__.py3
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']