From 0d3dd8b68b59da2efea25713df4b825c5c3d20f5 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 22 Aug 2008 14:18:53 +0000 Subject: [PATCH] Fixed #8485: Reordered imports in the database backends to ensure that the availability of the MySQL and Oracle backends is confirmed before any attempt is made to use the backend. Many thanks to Karen Tracey for her work in narrowing down a number of vague reports into a concrete problem. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8466 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/mysql/base.py | 12 ++++++------ django/db/backends/oracle/base.py | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index 9b82a1c8f0..07fb700eaa 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -6,12 +6,6 @@ Requires MySQLdb: http://sourceforge.net/projects/mysql-python import re -from django.db.backends import * -from django.db.backends.mysql.client import DatabaseClient -from django.db.backends.mysql.creation import DatabaseCreation -from django.db.backends.mysql.introspection import DatabaseIntrospection -from django.db.backends.mysql.validation import DatabaseValidation - try: import MySQLdb as Database except ImportError, e: @@ -30,6 +24,12 @@ if (version < (1,2,1) or (version[:3] == (1, 2, 1) and from MySQLdb.converters import conversions from MySQLdb.constants import FIELD_TYPE, FLAG +from django.db.backends import * +from django.db.backends.mysql.client import DatabaseClient +from django.db.backends.mysql.creation import DatabaseCreation +from django.db.backends.mysql.introspection import DatabaseIntrospection +from django.db.backends.mysql.validation import DatabaseValidation + # Raise exceptions for database warnings if DEBUG is on from django.conf import settings if settings.DEBUG: diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 33900e755c..83543969ea 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -8,13 +8,6 @@ import os import datetime import time -from django.db.backends import * -from django.db.backends.oracle import query -from django.db.backends.oracle.client import DatabaseClient -from django.db.backends.oracle.creation import DatabaseCreation -from django.db.backends.oracle.introspection import DatabaseIntrospection -from django.utils.encoding import smart_str, force_unicode - # Oracle takes client-side character set encoding from the environment. os.environ['NLS_LANG'] = '.UTF8' try: @@ -23,6 +16,13 @@ except ImportError, e: from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e) +from django.db.backends import * +from django.db.backends.oracle import query +from django.db.backends.oracle.client import DatabaseClient +from django.db.backends.oracle.creation import DatabaseCreation +from django.db.backends.oracle.introspection import DatabaseIntrospection +from django.utils.encoding import smart_str, force_unicode + DatabaseError = Database.Error IntegrityError = Database.IntegrityError