diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 14:16:29 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 14:16:29 +0000 |
| commit | 5b1e21e2006ec0b2b5484ca92e429fc457e9eb05 (patch) | |
| tree | 267a6ebea43a3e50d23b131a37bc6649664b27fa | |
| parent | 0a52a04a070fd46d50c2a0385349ef5f96d6dc58 (diff) | |
[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
| -rw-r--r-- | django/db/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/utils.py b/django/db/utils.py index 00b3568cb0..7c3e413726 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -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) |
