﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4311	urlresolvers.resolve and friends should return the name they resolved to.	Jeremy Dunck <jdunck@…>	nobody	"Now that urlresolvers.reverse and named URLPatterns are in place, I think it'd be good for resolve to return the name in addition to the callable and args/kwargs.

This would allow app-level branching depending on URL to be simpler.

As an example from a django-users list thread:
{{{
  is_login = request.path in (
    settings.LOGIN_REDIRECT_URL,
    settings.LOGIN_URL,
    settings.LOGOUT_URL)
  if ((not is_login) and ...
}}}

If urlresolvers.resolve() returned, (callable, args, kwargs, name) rather than (callable, args, kwargs), (where name is the name assigned in the URLPattern definition), you could have simpler code that inspected URL names and decided what to do with less muss.

{{{
if urlresolvers.resolve(url)[3].startswith('contrib.auth.urls.') 
}}}

The 3 is icky and auth doesn't actually include an urls file, but you get the point.  ;-)

Further, it'd be good if names were nested based on includes in a way that mirrors URLResolver includes so that the name of anything included by an app was prefixed by that app name.

For example:
{{{
urlpatterns = (
 ('^admin/', include('django.contrib.admin.urls')
)
}}}
Assuming the admin urls definition was changed to include things like this:
{{{
    ('^([^/]+)/([^/]+)/$', 'django.contrib.admin.views.main.change_list', name='change_list'),
}}}

Then a request path resolving to the admin change list would include a return name of 'django.contrib.admin.urls.change_list'.

I imagine the advice that urlconf names be global-ish is just due to current implementation limitation.  :)
http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns
"		new	Core (Other)	dev					Unreviewed	0	0	0	0	0	0
