Opened 8 years ago
Closed 8 years ago
#26911 closed Cleanup/optimization (fixed)
Remove NoReverseMatch silencing in RedirectView
Reported by: | Jerome Leclanche | Owned by: | K2 |
---|---|---|---|
Component: | Generic views | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | grzegorz.tezycki@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Relevant code: https://github.com/django/django/blob/bc53af13cbf09b0cbac945426c2d51d0ca52fff3/django/views/generic/base.py#L176-L180 (failing the if on line 196)
I'm taking the time to open this ticket because this wasted me a lot of time. I had a typo in my pattern_name
, which resulted in a 410 rather than an exception (as one would expect).
The documentation only says a 410 will be returned if "the resulting location is empty, or the url argument is None", but doesn't mention that it can mask errors.
This design should be reconsidered (per the zen of python, errors should never pass silently). Or at the very least, documented.
Change History (4)
comment:1 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 8 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Catching NoReverseMatch
will be removed as per consensus on django-developers.
comment:3 by , 8 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
Summary: | RedirectView failing silently on NoReverseMatch is confusing → Remove NoReverseMatch silencing in RedirectView |
I don't see a rationale for that decision on the original ticket: #15273. You'll need to write to the DevelopersMailingList to see if there's consensus to change it, otherwise updating the documentation will suffice.