Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #1673 -- Every database backend now raises ImproperlyConfigured…

… if the relevant Python database module raises ImportError

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8e9833f26199b99180877d043bf4e944b99af39b 1 parent 0c8ac09
Adrian Holovaty adrianholovaty authored
6 django/db/backends/ado_mssql/base.py
View
@@ -5,7 +5,11 @@
"""
from django.db.backends import util
-import adodbapi as Database
+try:
+ import adodbapi as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading adodbapi module: %s" % e
import datetime
try:
import mx
6 django/db/backends/mysql/base.py
View
@@ -5,7 +5,11 @@
"""
from django.db.backends import util
-import MySQLdb as Database
+try:
+ import MySQLdb as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e
from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE
import types
6 django/db/backends/oracle/base.py
View
@@ -5,7 +5,11 @@
"""
from django.db.backends import util
-import cx_Oracle as Database
+try:
+ import cx_Oracle as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading cx_Oracle module: %s" % e
import types
DatabaseError = Database.Error
6 django/db/backends/postgresql/base.py
View
@@ -5,7 +5,11 @@
"""
from django.db.backends import util
-import psycopg as Database
+try:
+ import psycopg as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading psycopg module: %s" % e
DatabaseError = Database.DatabaseError
6 django/db/backends/postgresql_psycopg2/base.py
View
@@ -5,7 +5,11 @@
"""
from django.db.backends import util
-import psycopg2 as Database
+try:
+ import psycopg2 as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e
DatabaseError = Database.DatabaseError
6 django/db/backends/sqlite3/base.py
View
@@ -3,7 +3,11 @@
"""
from django.db.backends import util
-from pysqlite2 import dbapi2 as Database
+try:
+ from pysqlite2 import dbapi2 as Database
+except ImportError, e:
+ from django.core.exceptions import ImproperlyConfigured
+ raise ImproperlyConfigured, "Error loading pysqlite2 module: %s" % e
DatabaseError = Database.DatabaseError
Please sign in to comment.
Something went wrong with that request. Please try again.