Commit c768bc6f authored by Luke Plant's avatar Luke Plant
Browse files

Fixed #8031 - url tag no longer silences NoReverseMatch exceptions since this is very rarely useful


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 8be1a430
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -364,12 +364,9 @@ class URLNode(Node):
        try:
            return reverse(self.view_name, args=args, kwargs=kwargs)
        except NoReverseMatch:
            try:
            project_name = settings.SETTINGS_MODULE.split('.')[0]
            return reverse(project_name + '.' + self.view_name,
                           args=args, kwargs=kwargs)
            except NoReverseMatch:
                return ''

class WidthRatioNode(Node):
    def __init__(self, val_expr, max_expr, max_width):
+3 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ import unittest
from datetime import datetime, timedelta

from django import template
from django.core import urlresolvers
from django.template import loader
from django.template.loaders import app_directories, filesystem
from django.utils.translation import activate, deactivate, ugettext as _
@@ -888,8 +889,8 @@ class Templates(unittest.TestCase):

            # Failures
            'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError),
            'url-fail02': ('{% url no_such_view %}', {}, ''),
            'url-fail03': ('{% url regressiontests.templates.views.client no_such_param="value" %}', {}, ''),
            'url-fail02': ('{% url no_such_view %}', {}, urlresolvers.NoReverseMatch),
            'url-fail03': ('{% url regressiontests.templates.views.client %}', {}, urlresolvers.NoReverseMatch),

            ### CACHE TAG ######################################################
            'cache01': ('{% load cache %}{% cache -1 test %}cache01{% endcache %}', {}, 'cache01'),