diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 13:56:54 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 13:56:54 +0000 |
| commit | 515b4d3aa82c6a6dcc5ac749b10434bafd6b646b (patch) | |
| tree | 9aa7f68b58828d4b9d211c63809f6cd94877c8a0 | |
| parent | f53491db6e1aa1f19f627b60ff2bcd2ff40b128a (diff) | |
Fixed #14381 -- Clarified exception handling when instantiating Routers. Thanks to dauerbaustelle for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14005 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) |
