#5140: url templatetag should raise exception on invalid path
-------------------------------------+--------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Template system
Version: SVN | Keywords: url templatetag
Stage: Unreviewed | Has_patch: 0
-------------------------------------+--------------------------------------
I just stumbled across the fact, that the '''url templatetag''' silently
accepts any path to a view - no matter if it exists or not. In the module
django.template.defaulttags I have seen, that after processing the
templatetag an URLNode is generatet and afterwards rendered.
{{{
def render(self, context):
from django.core.urlresolvers import reverse, NoReverseMatch
args = [arg.resolve(context) for arg in self.args]
kwargs = dict([(smart_str(k,'ascii'), v.resolve(context)) for k, v
in self.kwargs.items()])
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 ''
}}}
The last try-catch-block which catches the second NoReverseMatch exception
is causing the troubles. At least in my eyes.[[BR]]
I would find it much more convenient if I actually get the exception when
I cause such an error. This would have saved my some time today, as I
created such an error during my Django studies.
--
Ticket URL: <http://code.djangoproject.com/ticket/5140>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---