From 345c4c4629c8d17a8b4826fb4b97a61f19326e9f Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 10 Sep 2011 22:31:38 +0000 Subject: [PATCH] Remove a bunch of deadcode/dead imports. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16794 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/creation.py | 4 ++-- django/db/models/base.py | 1 - django/db/models/query.py | 2 +- django/db/models/sql/compiler.py | 7 ++----- django/db/models/sql/query.py | 3 +-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index 8cfca3b850..8f4958867b 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -61,7 +61,7 @@ class BaseDatabaseCreation(object): if f.rel: ref_output, pending = self.sql_for_inline_foreign_key_references(f, known_models, style) if pending: - pr = pending_references.setdefault(f.rel.to, []).append((model, f)) + pending_references.setdefault(f.rel.to, []).append((model, f)) else: field_output.extend(ref_output) table_output.append(' '.join(field_output)) @@ -267,7 +267,7 @@ class BaseDatabaseCreation(object): # Get a cursor (even though we don't need one yet). This has # the side effect of initializing the test database. - cursor = self.connection.cursor() + self.connection.cursor() return test_database_name diff --git a/django/db/models/base.py b/django/db/models/base.py index 4b3220b514..b5ce39e3d5 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -474,7 +474,6 @@ class Model(object): ('raw', 'cls', and 'origin'). """ using = using or router.db_for_write(self.__class__, instance=self) - connection = connections[using] assert not (force_insert and force_update) if cls is None: cls = self.__class__ diff --git a/django/db/models/query.py b/django/db/models/query.py index 0e1a1b31b4..246b155b0c 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -9,7 +9,7 @@ from django.db.models.fields import AutoField from django.db.models.query_utils import (Q, select_related_descend, deferred_class_factory, InvalidQuery) from django.db.models.deletion import Collector -from django.db.models import signals, sql +from django.db.models import sql from django.utils.functional import partition # Used to control how many objects are worked with at once in some cases (e.g. diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 9ddcfc63f9..6bf7de2e21 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -1,14 +1,13 @@ from itertools import izip from django.core.exceptions import FieldError -from django.db import connections 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.datastructures import EmptyResultSet from django.db.models.sql.expressions import SQLEvaluator -from django.db.models.sql.query import (get_proxied_model, get_order_dir, - select_related_descend, Query) +from django.db.models.sql.query import get_proxied_model, get_order_dir, Query from django.db.utils import DatabaseError @@ -875,8 +874,6 @@ class SQLUpdateCompiler(SQLCompiler): Creates the SQL for this query. Returns the SQL string and list of parameters. """ - from django.db.models.base import Model - self.pre_sql_setup() if not self.query.values: return '', () diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 101d4ac7a5..61fd2be40b 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -15,7 +15,7 @@ from django.utils.tree import Node from django.db import connections, DEFAULT_DB_ALIAS from django.db.models import signals from django.db.models.fields import FieldDoesNotExist -from django.db.models.query_utils import select_related_descend, InvalidQuery +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.datastructures import EmptyResultSet, Empty, MultiJoin @@ -567,7 +567,6 @@ class Query(object): field_names, defer = self.deferred_loading if not field_names: return - columns = set() orig_opts = self.model._meta seen = {} if orig_opts.proxy: