Opened 9 years ago

Closed 9 years ago

#25037 closed New feature (fixed)

Add request.user to the debug view

Reported by: Grigoriy Kramarenko Owned by: John Moses
Component: Error reporting Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Displays the username in the mail for admins (used in views.debug.ExceptionReporterFilter) that caused the error:

Request repr():
<HttpRequest
path:/somepath/,
USER:None,
GET:{'get-key': 'get-value'},
POST:{'post-key': 'post-value'},
COOKIES:{'post-key': 'post-value'},
META:{'post-key': 'post-value'}>

Attachments (1)

25037.diff (4.2 KB ) - added by Grigoriy Kramarenko 9 years ago.

Download all attachments as: .zip

Change History (17)

by Grigoriy Kramarenko, 9 years ago

Attachment: 25037.diff added

comment:1 by Grigoriy Kramarenko, 9 years ago

Has patch: set

comment:2 by Claude Paroz, 9 years ago

Component: UncategorizedHTTP handling
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

I think this is a nice addition. Would it be possible to transform the patch in a pull request?
We'll also need more tests (with anonymous user, authenticated user, custom user, etc.).

comment:3 by Tim Graham, 9 years ago

Although it's a common pattern to set request.user, I had some reservations about coupling HttpRequest and contrib.auth when I first read this.

Sentry seems to have some way to associate exceptions with users. Maybe it would be worth looking at how they accomplish that?

in reply to:  3 comment:4 by Grigoriy Kramarenko, 9 years ago

Replying to timgraham:

Although it's a common pattern to set request.user, I had some reservations about coupling HttpRequest and contrib.auth when I first read this.

Sentry seems to have some way to associate exceptions with users. Maybe it would be worth looking at how they accomplish that?

This decision does not depend on contrib.auth and request.user. But when there they - it is of great help to solve the problems of administrators.

Version 0, edited 9 years ago by Grigoriy Kramarenko (next)

comment:5 by Vlastimil Zíma, 9 years ago

Note, that build_request_repr was removed in #25099.

comment:6 by Tim Graham, 9 years ago

Component: HTTP handlingError reporting
Easy pickings: set
Summary: Addition to functions http.requests.build_request_reprAdd request.user to the debug view

It seems the new alternative would be to add it to views.debug.TECHNICAL_500_TEMPLATE and TECHNICAL_500_TEXT_TEMPLATE under "Request information".

comment:7 by Julian Gindi, 9 years ago

Owner: changed from nobody to Julian Gindi
Status: newassigned

comment:8 by Julian Gindi, 9 years ago

Based on the latest comment, I'll move ahead with the mentioned implementation as opposed to continuing the work from the first patch. Does that sound right?

comment:9 by Tim Graham, 9 years ago

Yes, the initial patch will no longer apply.

comment:10 by John Moses, 9 years ago

Where should the associated test with this go?

comment:11 by Tim Graham, 9 years ago

There are tests for the debug view in tests/view_tests/tests/test_debug.py.

comment:12 by John Moses, 9 years ago

Owner: changed from Julian Gindi to John Moses

comment:14 by Tim Graham, 9 years ago

Needs tests: unset

comment:15 by John Moses, 9 years ago

Patch needs improvement: unset

comment:16 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 2b6344e:

Fixed #25037 -- Added request.user to the debug view.

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