Django

Code

Ticket #878 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

URLconf regexp captures should be passed as *args

Reported by: aaronsw Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

11/22/05 13:41:16 changed 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.

11/22/05 13:42:43 changed by hugo

  • status changed from new to closed.
  • resolution set to invalid.

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.

11/27/05 08:30:49 changed by adrian

  • status changed from closed to reopened.
  • resolution deleted.

This is an intriguing idea.

11/27/05 16:08:52 changed by adrian

  • status changed from reopened to closed.
  • resolution set to fixed.

(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/Change #878 (URLconf regexp captures should be passed as *args)




Change Properties
Action