Skip to content

When user is user_id has exception. #25

@whyliu

Description

@whyliu
  • 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'):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions