Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#878 closed defect (fixed)

URLconf regexp captures should be passed as *args

Reported by: aaronsw Owned by: adrian
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently you have to write (?P<foo>) to get a capture out of a URL regular expression and into your function. Since this seems to be what you almost always want to do, why not just treat it like a normal regular expression and pass on every capture that doesn't start with ?:

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by hugo

url patterns aren't necessarily in the same order as function parameters. So *args is rather useless, as it would be a fixed, predefined order of elements in the url.

comment:2 Changed 8 years ago by hugo

  • Resolution set to invalid
  • Status changed from new to closed

Additioinally I think stuff like this should be just asked in the django-users list - this is more a "why is it that way" question than an actual "defect". It might be that because of a discussion on the list this will become an enhancement or defect - but for now it's just an enquiry and that's best done in either the IRC channel or the mailing lists.

comment:3 Changed 8 years ago by adrian

  • Resolution invalid deleted
  • Status changed from closed to reopened

This is an intriguing idea.

comment:4 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [1470]) Fixed #878 -- URLconf regex captures no longer have to be named groups. Old URLconfs (with named groups) still work. This is backwards-incompatible if you've defined custom middleware with a process_view function. See http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.