Author: russellm
Date: 2010-10-08 08:56:54 -0500 (Fri, 08 Oct 2010)
New Revision: 14005

Modified:
   django/trunk/django/db/utils.py
Log:
Fixed #14381 -- Clarified exception handling when instantiating Routers. Thanks 
to dauerbaustelle for the suggestion and patch.

Modified: django/trunk/django/db/utils.py
===================================================================
--- django/trunk/django/db/utils.py     2010-10-08 13:53:25 UTC (rev 14004)
+++ django/trunk/django/db/utils.py     2010-10-08 13:56:54 UTC (rev 14005)
@@ -111,9 +111,11 @@
                 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)

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to