Code

Opened 6 years ago

Closed 6 years ago

#6539 closed (duplicate)

Debug display traces decorator instead of view on error

Reported by: briand Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I'm not sure what other error conditions may cause this to happen, but in my case it was a decorated view function where I forgot to return an HttpResponse object.

The view function:

@login_required
def index(request):
    pass

Throws the debugger page message:

The view django.contrib.auth.decorators._CheckLogin.__call__ didn't return an HttpResponse object.

And only shows the traceback on the decorator, no traceback context for the actual failing view is displayed. Any reasonably astute developer would realize where the error is really coming from, but given an otherwise complete view it took me a few minutes to realize my last statement was a render_to_response call without a preceeding return statement.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is essentially a variation on #5701 (and some other related tickets) regarding setting up attributes on decorators correctly.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.