Skip to content
Browse files

Fixed #12718 -- Tighten up the error handling when loading database r…

…outers. Thanks to Jeff Balogh for the report and patch.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 7856a75 commit 0cdd36fac857d19105e3872364147a5cebd45513 @freakboy3742 freakboy3742 committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/db/
5 django/db/
@@ -95,11 +95,12 @@ def __init__(self, routers):
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))
router = r

0 comments on commit 0cdd36f

Please sign in to comment.
Something went wrong with that request. Please try again.