When user is user_id has exception.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3
- Forks
- 14
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
- edx-when version: 0.4
- Django version: 1.11
- Python version:2.7
- Operating System: ubuntu 16.04
Description
[Thu Feb 13 20:27:43.548798 2020] [:error] [pid 25110] File "/edx/apps/edx/venvs/edxapp/lib/python2.7/site-packages/edx_when/api.py", line 82, in get_dates_for_course
[Thu Feb 13 20:27:43.548802 2020] [:error] [pid 25110] user_id = user.id if not user.is_anonymous else ''
[Thu Feb 13 20:27:43.548805 2020] [:error] [pid 25110] AttributeError: 'long' object has no attribute 'is_anonymous'
What I Did
In api.py get_dates_for_course()
...
if isinstance(user, int):
...
In Python2.x, int and long is different type, change to
if not if hasattr(user,'is_anonymous'):
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 in api.py at get_dates_for_course(), where the traceback shows a numeric user value being accessed as though it had is_anonymous. Check the Python 2 int and long handling described in the issue, then verify that numeric user IDs no longer raise this AttributeError while user objects retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100