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)
Change History (17)
by , 9 years ago
Attachment: | 25037.diff added |
---|
comment:1 by , 9 years ago
Has patch: | set |
---|
comment:2 by , 9 years ago
Component: | Uncategorized → HTTP handling |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
follow-up: 4 comment:3 by , 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?
comment:4 by , 9 years ago
Replying to timgraham:
Although it's a common pattern to set
request.user
, I had some reservations about couplingHttpRequest
andcontrib.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.
Maybe need test with 2 options: with request.user and without it.
comment:6 by , 9 years ago
Component: | HTTP handling → Error reporting |
---|---|
Easy pickings: | set |
Summary: | Addition to functions http.requests.build_request_repr → Add 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 , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 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:11 by , 9 years ago
There are tests for the debug view in tests/view_tests/tests/test_debug.py
.
comment:12 by , 9 years ago
Owner: | changed from | to
---|
comment:14 by , 9 years ago
Needs tests: | unset |
---|
comment:15 by , 9 years ago
Patch needs improvement: | unset |
---|
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.).