﻿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
12943	Unnamed captures are not passed to views in included URLconfs	petri.lehtinen@…	Bas Peschier	"{{{
### mypkg/views.py:
def my_view(request, *args, **kwargs):
    print args
    print kwargs

### mypkg/urls.py:
urlpatterns = patterns('mypkg.views', (r'^$', 'my_view'))

### otherpkg/urls.py:
urlpatterns = patterns('', (r'^(\w+)/', include('mypkg.urls'))
}}}

With this setup, in `my_view()`, both `args` and `kwargs` are empty, even though there are no named captures that would make Django ignore the unnamed ones.

The following works, as the capture in the upper URLconf is named:
{{{
### otherpkg/urls.py:
urlpatterns = patterns('', (r'^(?P<foo>\w+)/', include('mypkg.urls'))
}}}
In this case, `foo` is passed as a kwarg to `my_view()`.

The attached patch fixes this, but there's still an issue with extra kwargs to views: As the URL resolving returns triples of the form `(view_func, view_args, view_kwargs)` along from sub URLconfs back to the including URLconf, there's no way of knowing whether we had named captures or extra kwargs in the sub URLconf. They are all collected to `view_kwargs` which is then returned.

This could be fixed by passing around quadruples `(view_func, view_args, view_kwargs, extra_kwargs)`, and collect all named URL captures along the chain to `view_kwargs` and all extra kwargs to `extra_kwargs`. If at some level the `view_kwargs` is not empty, we can throw away all the unnamed captures, i.e. set `view_args` to `()`. This fix would be a bit more intrusive, though, so I haven't tried to do it yet."	Bug	closed	Core (URLs)	1.1	Normal	fixed	ams2015		Ready for checkin	1	0	0	0	0	0
