Django

Code

Ticket #4925 (closed: wontfix)

Opened 3 years ago

Last modified 3 years ago

Keyword arguments make the resolver drop positional arguments

Reported by: dusk@woofle.net Assigned to: jacob
Milestone: Component: Uncategorized
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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.

Attachments

Change History

07/19/07 04:49:24 changed by mtredinnick

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to wontfix.
  • needs_tests changed.
  • needs_docs changed.

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.


Add/Change #4925 (Keyword arguments make the resolver drop positional arguments)




Change Properties
Action