mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[1.2.X] Fixed #14381 -- Clarified exception handling when instantiating Routers. Thanks to dauerbaustelle for the suggestion and patch.
Backport of r14005 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0a52a04a07
commit
5b1e21e200
@ -111,9 +111,11 @@ class ConnectionRouter(object):
|
||||
except ImportError, e:
|
||||
raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e))
|
||||
try:
|
||||
router = getattr(module, klass_name)()
|
||||
router_class = getattr(module, klass_name)
|
||||
except AttributeError:
|
||||
raise ImproperlyConfigured('Module "%s" does not define a database router name "%s"' % (module, klass_name))
|
||||
else:
|
||||
router = router_class()
|
||||
else:
|
||||
router = r
|
||||
self.routers.append(router)
|
||||
|
Loading…
x
Reference in New Issue
Block a user