Opened 15 years ago
Closed 15 years ago
#13193 closed (wontfix)
Reverse should ignore unused kwargs like Python string interpolation
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Python does a good job ignoring unused kwargs with string formatting, django should as well.
url(r'^member/(?P<id>\d+)/$', 'edit', name="edit"), reverse('edit', kwargs={'id': 3}) #SUCCESS reverse('edit', kwargs={'id': 3, 'random key': 'stuff'}) #FAILS
Attachments (3)
Change History (10)
by , 15 years ago
Attachment: | reverse_ignore_kwargs.diff added |
---|
comment:1 by , 15 years ago
milestone: | 1.2 |
---|
comment:2 by , 15 years ago
by , 15 years ago
Attachment: | reverse_ignore_kwargs.2.diff added |
---|
comment:3 by , 15 years ago
second patch makes sure params is a subset of kwargs. This is officially a one character change :)
comment:5 by , 15 years ago
Component: | Uncategorized → Core framework |
---|---|
Has patch: | set |
Needs tests: | set |
by , 15 years ago
Attachment: | reverse_ignore_kwargs.3.diff added |
---|
comment:6 by , 15 years ago
3rd diff should work a lot better, we don't want to skip if the sets are equal. My logic was a bit twisted, should be good now though.
comment:7 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I disagree that this would be a good thing. For example, this could give you the impression that you are reversing to a view that will honor to 'random key', when in fact the argument will be silently ignored.
If you want to argue your case for this, open a discussion on django-developers.
I think better would be to require that the RHS set is a strict superset of the LHS set.