summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2/base.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-05-26 18:58:46 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-05-26 18:58:46 +0000
commit8e9833f26199b99180877d043bf4e944b99af39b (patch)
tree0a5caa10b7e7b27875118f8efa78cbc75aa9538b /django/db/backends/postgresql_psycopg2/base.py
parent0c8ac0972c9b1a5af95d40334b83cf5f31d56331 (diff)
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
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/base.py')
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index 9376c36772..13e7be7a98 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -5,7 +5,11 @@ Requires psycopg 2: http://initd.org/projects/psycopg2
"""
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