Code

Ticket #7524: 01-url-import-exception.patch

File 01-url-import-exception.patch, 866 bytes (added by jarrow, 6 years ago)

Simply always keep the original exception

  • django/core/urlresolvers.py

     
    254254        try: 
    255255            return self._urlconf_module 
    256256        except AttributeError: 
    257             try: 
    258                 self._urlconf_module = __import__(self.urlconf_name, {}, {}, ['']) 
    259             except Exception, e: 
    260                 # Either an invalid urlconf_name, such as "foo.bar.", or some 
    261                 # kind of problem during the actual import. 
    262                 raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e) 
     257            self._urlconf_module = __import__(self.urlconf_name, {}, {}, ['']) 
    263258            return self._urlconf_module 
    264259    urlconf_module = property(_get_urlconf_module) 
    265260