summaryrefslogtreecommitdiff
path: root/django/db/utils.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-01-28 05:55:44 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-01-28 05:55:44 +0000
commit0cdd36fac857d19105e3872364147a5cebd45513 (patch)
tree78e9691083dd583e5d776fcfa16609d88b7c7792 /django/db/utils.py
parent7856a759d0af09bf6295087941a4dfc5e6589d72 (diff)
Fixed #12718 -- Tighten up the error handling when loading database routers. Thanks to Jeff Balogh for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/utils.py')
-rw-r--r--django/db/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/utils.py b/django/db/utils.py
index 83e2452546..fe5d7944aa 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -95,11 +95,12 @@ class ConnectionRouter(object):
try:
module_name, klass_name = r.rsplit('.', 1)
module = import_module(module_name)
- router = getattr(module, klass_name)()
except ImportError, e:
raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e))
+ try:
+ router = getattr(module, klass_name)()
except AttributeError:
- raise ImproperlyConfigured('Module "%s" does not define a "%s" database router' % (module, klass_name))
+ raise ImproperlyConfigured('Module "%s" does not define a database router name "%s"' % (module, klass_name))
else:
router = r
self.routers.append(router)