Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #8485: Reordered imports in the database backends to ensure tha…

…t 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
  • Loading branch information...
commit 0d3dd8b68b59da2efea25713df4b825c5c3d20f5 1 parent 343c255
Russell Keith-Magee freakboy3742 authored
12 django/db/backends/mysql/base.py
View
@@ -6,12 +6,6 @@
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 @@
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:
14 django/db/backends/oracle/base.py
View
@@ -8,13 +8,6 @@
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 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.