Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12693 -- Improved error handling when there is an error settin…

…g up the database router chain. Thanks to dhageman for the report and fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c6ee1f6f242a6fa5336ce7a670cebae72568ef0c 1 parent c8873bb
Russell Keith-Magee authored January 27, 2010

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  django/db/utils.py
11  django/db/utils.py
@@ -92,9 +92,14 @@ def __init__(self, routers):
92 92
         self.routers = []
93 93
         for r in routers:
94 94
             if isinstance(r, basestring):
95  
-                module_name, klass_name = r.rsplit('.', 1)
96  
-                module = import_module(module_name)
97  
-                router = getattr(module, klass_name)()
  95
+                try:
  96
+                    module_name, klass_name = r.rsplit('.', 1)
  97
+                    module = import_module(module_name)
  98
+                    router = getattr(module, klass_name)()
  99
+                except ImportError, e:
  100
+                    raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e))
  101
+                except AttributeError:
  102
+                    raise ImproperlyConfigured('Module "%s" does not define a "%s" database router' % (module, klass_name))
98 103
             else:
99 104
                 router = r
100 105
             self.routers.append(router)

0 notes on commit c6ee1f6

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