Opened 9 years ago

Closed 9 years ago

#4925 closed (wontfix)

Keyword arguments make the resolver drop positional arguments

Reported by: dusk@… Owned by: jacob
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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.

Change History (1)

comment:1 Changed 9 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.
Back to Top