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
This commit is contained in:
parent
343c255016
commit
0d3dd8b68b
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue