Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improved error message in urlresolvers (fixes #240)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@357 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit af95567c1425975353567acba8af6f14a8802276 1 parent 2f04115
Jacob Kaplan-Moss authored August 01, 2005

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  django/core/urlresolvers.py
6  django/core/urlresolvers.py
@@ -38,8 +38,10 @@ def get_callback(self):
38 38
         mod_name, func_name = get_mod_func(self.callback)
39 39
         try:
40 40
             return getattr(__import__(mod_name, '', '', ['']), func_name)
41  
-        except (ImportError, AttributeError), e:
42  
-            raise ViewDoesNotExist, "Tried %s. Error was: %s" % (self.callback, str(e))
  41
+        except ImportError, e:
  42
+            raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e))
  43
+        except AttributeError, e:
  44
+            raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e))
43 45
 
44 46
 class RegexURLMultiplePattern:
45 47
     def __init__(self, regex, urlconf_module):

0 notes on commit af95567

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