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
This commit is contained in:
Luke Plant 2008-08-05 14:16:13 +00:00
parent 8be1a43093
commit c768bc6f25
2 changed files with 6 additions and 8 deletions

View File

@ -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):

View File

@ -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'),