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:
parent
8be1a43093
commit
c768bc6f25
|
@ -364,12 +364,9 @@ class URLNode(Node):
|
||||||
try:
|
try:
|
||||||
return reverse(self.view_name, args=args, kwargs=kwargs)
|
return reverse(self.view_name, args=args, kwargs=kwargs)
|
||||||
except NoReverseMatch:
|
except NoReverseMatch:
|
||||||
try:
|
|
||||||
project_name = settings.SETTINGS_MODULE.split('.')[0]
|
project_name = settings.SETTINGS_MODULE.split('.')[0]
|
||||||
return reverse(project_name + '.' + self.view_name,
|
return reverse(project_name + '.' + self.view_name,
|
||||||
args=args, kwargs=kwargs)
|
args=args, kwargs=kwargs)
|
||||||
except NoReverseMatch:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
class WidthRatioNode(Node):
|
class WidthRatioNode(Node):
|
||||||
def __init__(self, val_expr, max_expr, max_width):
|
def __init__(self, val_expr, max_expr, max_width):
|
||||||
|
|
|
@ -11,6 +11,7 @@ import unittest
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
from django.core import urlresolvers
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
from django.template.loaders import app_directories, filesystem
|
from django.template.loaders import app_directories, filesystem
|
||||||
from django.utils.translation import activate, deactivate, ugettext as _
|
from django.utils.translation import activate, deactivate, ugettext as _
|
||||||
|
@ -888,8 +889,8 @@ class Templates(unittest.TestCase):
|
||||||
|
|
||||||
# Failures
|
# Failures
|
||||||
'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError),
|
'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError),
|
||||||
'url-fail02': ('{% url no_such_view %}', {}, ''),
|
'url-fail02': ('{% url no_such_view %}', {}, urlresolvers.NoReverseMatch),
|
||||||
'url-fail03': ('{% url regressiontests.templates.views.client no_such_param="value" %}', {}, ''),
|
'url-fail03': ('{% url regressiontests.templates.views.client %}', {}, urlresolvers.NoReverseMatch),
|
||||||
|
|
||||||
### CACHE TAG ######################################################
|
### CACHE TAG ######################################################
|
||||||
'cache01': ('{% load cache %}{% cache -1 test %}cache01{% endcache %}', {}, 'cache01'),
|
'cache01': ('{% load cache %}{% cache -1 test %}cache01{% endcache %}', {}, 'cache01'),
|
||||||
|
|
Loading…
Reference in New Issue