#878 closed defect (fixed)
URLconf regexp captures should be passed as *args
Reported by: | aaronsw | Owned by: | Adrian Holovaty |
---|---|---|---|
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: | no | UI/UX: | no |
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 ?:
Change History (4)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Resolution: | → invalid |
---|---|
Status: | new → 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 by , 19 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
This is an intriguing idea.
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → 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
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.