Opened 17 years ago
Closed 17 years ago
#4925 closed (wontfix)
Keyword arguments make the resolver drop positional arguments
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Given the URL configuration
from django.conf.urls.defaults import * def func(request): pass urlpatterns = patterns('', (r'^(\d+)/(?P<kwarg>\d+)/$', func), )
The following occurs:
>>> import django.core.urlresolvers >>> django.core.urlresolvers.resolve('/123/456/') (<function func2 at 0x133ec30>, (), {'kwarg': '456'})
Note that the positional argument '123' is lost, causing a regression I observed in my patch for #4915.
Note:
See TracTickets
for help on using tickets.
This is intended behaviour. See the documentation. I guess the main reason is that mixing of positional and keyword arguments can lead to ambiguities for many people and cases (if you interleave positional and keyword arg), so we ask people to pick one or the other.