Opened 4 years ago

Closed 4 years ago

#21912 closed Cleanup/optimization (fixed)

Improve error message "The view ___ didn't return an HttpResponse object."

Reported by: brycenesbitt Owned by: AeroNotix
Component: Core (Other) Version: 1.7-alpha-1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The error message "The view _ didn't return an HttpResponse object." in base.py leaves
open the question "What did it return"? This is a proposal to change the message to:

"The view _ returned None: an HttpResponse object was expected."

The code in question is:


              # Complain if the view returned None (a common error).
                if response is None:
                    if isinstance(callback, types.FunctionType):    # FBV
                        view_name = callback.__name__
                    else:                                           # CBV
                        view_name = callback.__class__.__name__ + '.__call__'
                    raise ValueError("The view %s.%s didn't return an HttpResponse object."
                 % (callback.__module__, view_name))

Change History (3)

comment:1 Changed 4 years ago by Marc Tamlyn

Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by AeroNotix

Owner: changed from nobody to AeroNotix
Status: newassigned

comment:3 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 1150053b994a6de665db51a18a07b992bd6714f1:

Fixed #21912 -- Improved error message if a view returns None.

Thanks brycenesbitt for the report.

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