Ticket #19827: #19827-stacktrace_on_reraise.diff

File #19827-stacktrace_on_reraise.diff, 1.1 KB (added by German M. Bravo, 12 years ago)
  • django/template/defaulttags.py

    class URLNode(Node):  
    409408        url = ''
    410409        try:
    411410            url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
    412         except NoReverseMatch, e:
     411        except NoReverseMatch:
    413412            if settings.SETTINGS_MODULE:
     413                exc_info = sys.exc_info()
    414414                project_name = settings.SETTINGS_MODULE.split('.')[0]
    415415                try:
    416416                    url = reverse(project_name + '.' + view_name,
    class URLNode(Node):  
    421421                        # Re-raise the original exception, not the one with
    422422                        # the path relative to the project. This makes a
    423423                        # better error message.
    424                         raise e
     424                        raise exc_info[0], exc_info[1], exc_info[2]
    425425            else:
    426426                if self.asvar is None:
    427                     raise e
     427                    raise
    428428
    429429        if self.asvar:
    430430            context[self.asvar] = url
Back to Top