Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #12693 -- Improved error handling when there is an error settin…

…g up the database router chain. Thanks to dhageman for the report and fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c6ee1f6f242a6fa5336ce7a670cebae72568ef0c 1 parent c8873bb
@freakboy3742 freakboy3742 authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 django/db/utils.py
View
11 django/db/utils.py
@@ -92,9 +92,14 @@ def __init__(self, routers):
self.routers = []
for r in routers:
if isinstance(r, basestring):
- module_name, klass_name = r.rsplit('.', 1)
- module = import_module(module_name)
- router = getattr(module, klass_name)()
+ 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))
+ except AttributeError:
+ raise ImproperlyConfigured('Module "%s" does not define a "%s" database router' % (module, klass_name))
else:
router = r
self.routers.append(router)
Please sign in to comment.
Something went wrong with that request. Please try again.