openedx / openedx/openedx-platform
'WSGIRequest' object has no attribute 'user' error in enterprise code
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
This line of enterprise code, is resulting in the error: builtins.AttributeError: 'WSGIRequest' object has no attribute 'user'.
I believe this just needs some simple exception handling to provide the same treatment as is done for an anonymous (not logged in) user, without raising an exception.
- This should be a relatively quick fix.
- This may not lead to end user problems, because it may just be happening during 404 processing, but I'm uncertain. It definitely muddies the 404 error details and observability.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with openedx/features/enterprise_support/utils.py around line 331 in the linked enterprise code and trace how the request user is accessed during 404 processing. Compare that path with the existing anonymous-user treatment. Done means the missing user attribute no longer raises an exception and 404 error details remain useful; the issue does not name a test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100