Opened 8 years ago

Closed 7 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 Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

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.

comment:2 by K2, 7 years ago

Cc: grzegorz.tezycki@… added
Owner: changed from nobody to K2
Status: newassigned
Version 1, edited 7 years ago by K2 (previous) (next) (diff)

comment:3 by Tim Graham, 7 years ago

Has patch: set
Patch needs improvement: set
Summary: RedirectView failing silently on NoReverseMatch is confusingRemove NoReverseMatch silencing in RedirectView

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In fede6526:

Fixed #26911 -- Removed NoReverseMatch silencing in RedirectView.

Note: See TracTickets for help on using tickets.
Back to Top