Cleaned up some small bits of the ORM, including removing an import *.

This commit is contained in:
Alex Gaynor 2012-09-07 10:58:17 -04:00
parent 39aa8901e1
commit 0e296131bb
3 changed files with 7 additions and 12 deletions

View File

@ -4,7 +4,8 @@ from django.core.exceptions import FieldError
from django.db import transaction
from django.db.backends.util import truncate_name
from django.db.models.query_utils import select_related_descend
from django.db.models.sql.constants import *
from django.db.models.sql.constants import (SINGLE, MULTI, ORDER_DIR,
LOOKUP_SEP, GET_ITERATOR_CHUNK_SIZE)
from django.db.models.sql.datastructures import EmptyResultSet
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.query import get_order_dir, Query
@ -811,7 +812,7 @@ class SQLCompiler(object):
raise EmptyResultSet
except EmptyResultSet:
if result_type == MULTI:
return empty_iter()
return iter([])
else:
return
@ -1088,13 +1089,6 @@ class SQLDateCompiler(SQLCompiler):
yield date
def empty_iter():
"""
Returns an iterator containing no results.
"""
yield next(iter([]))
def order_modified_iter(cursor, trim, sentinel):
"""
Yields blocks of rows from a cursor. We use this iterator in the special

View File

@ -17,9 +17,9 @@ from django.db import connections, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.db.models.expressions import ExpressionNode
from django.db.models.fields import FieldDoesNotExist
from django.db.models.query_utils import InvalidQuery
from django.db.models.sql import aggregates as base_aggregates_module
from django.db.models.sql.constants import *
from django.db.models.sql.constants import (QUERY_TERMS, LOOKUP_SEP, ORDER_DIR,
SINGLE, ORDER_PATTERN, JoinInfo)
from django.db.models.sql.datastructures import EmptyResultSet, Empty, MultiJoin
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import (WhereNode, Constraint, EverythingNode,
@ -28,6 +28,7 @@ from django.core.exceptions import FieldError
__all__ = ['Query', 'RawQuery']
class RawQuery(object):
"""
A single raw SQL query

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from datetime import date
from django.db.models.sql.query import InvalidQuery
from django.db.models.query_utils import InvalidQuery
from django.test import TestCase
from .models import Author, Book, Coffee, Reviewer, FriendlyAuthor