#21396 closed Bug (fixed)
Backwards-incompatible change in RedirectView.get_redirect_url
| Reported by: | Aymeric Augustin | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | Baptiste Mispelon | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
[b7bd7087] (for #15273) changes the signature of RedirectView.get_redirect_url. The documented signature is RedirectView.get_redirect_url(self, **kwargs).
In Django 1.5 that was correct; in Django 1.6, unnamed URL captures are passed as positional arguments.
We should at least fix the documentation and mention the backwards incompatibility in the release notes.
Change History (5)
comment:1 by , 12 years ago
| Cc: | added |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 12 years ago
| Has patch: | set |
|---|
I made a PR for the documentation issue: https://github.com/django/django/pull/1889
comment:3 by , 12 years ago
| Component: | Generic views → Documentation |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
comment:4 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The documentation of
get_redirect_url[1] should be amended to reflect the new signature (self, *args, **kwargs) and also to describe the usage of the newpattern_nameattribute.There is indeed a problem if someone has extended
RedirectViewand definedget_redirect_urlonly taking**kwargsas arguments (as is documented).If that view is used on a urlpattern that has unnamed capture groups, a
TypeErrorwill be thrown.We might be able to restore backwards-compatibility with some introspection on the method's signature (
inspect.getargspect) or maybe with sometry/exceptstatements inRedirectView.get.[1] https://docs.djangoproject.com/en/1.6/ref/class-based-views/base/#django.views.generic.base.RedirectView.get_redirect_url