Skip to content

Commit

Permalink
[1.2.X] Fixed #14381 -- Clarified exception handling when instantiati…
Browse files Browse the repository at this point in the history
…ng 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
  • Loading branch information
freakboy3742 committed Oct 8, 2010
1 parent 0a52a04 commit 5b1e21e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django/db/utils.py
Expand Up @@ -111,9 +111,11 @@ def __init__(self, routers):
except ImportError, e: except ImportError, e:
raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e)) raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e))
try: try:
router = getattr(module, klass_name)() router_class = getattr(module, klass_name)
except AttributeError: except AttributeError:
raise ImproperlyConfigured('Module "%s" does not define a database router name "%s"' % (module, klass_name)) raise ImproperlyConfigured('Module "%s" does not define a database router name "%s"' % (module, klass_name))
else:
router = router_class()
else: else:
router = r router = r
self.routers.append(router) self.routers.append(router)
Expand Down

0 comments on commit 5b1e21e

Please sign in to comment.