Ticket #6379: no_exception_hiding.diff

File no_exception_hiding.diff, 1.0 KB (added by Bastian Kleineidam <calvin@…>, 7 years ago)
  • django/core/urlresolvers.py

     
    178178            self._callback = get_callable(self._callback_str)
    179179        except ImportError, e:
    180180            mod_name, _ = get_mod_func(self._callback_str)
    181             raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e))
     181            msg = str(e)
     182            if not msg.endswith(mod_name):
     183                raise
     184            raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, msg)
    182185        except AttributeError, e:
    183186            mod_name, func_name = get_mod_func(self._callback_str)
     187            msg = str(e)
     188            if not (mod_name in msg and func_name in msg):
     189                raise
    184190            raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e))
    185191        return self._callback
    186192    callback = property(_get_callback)
Back to Top