Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error when loading /Users sometime after release 0.8.2 #20

Closed
pablodiazgutierrez opened this issue Apr 14, 2019 · 2 comments
Closed
Labels

Comments

@pablodiazgutierrez
Copy link
Contributor

I just updated from 0.5.* to the latest 0.10.6 and noticed I consistently get a 500 error () when loading /Users and /Groups:

unbound method get_user_model() must be called with UsersView instance as first argument (got nothing instead)

We use Python 2.7 and Django 1.11, and at no point the stack trace shows our internal code:

ERROR 2019-04-14 13:26:16,237 views 31136 139791130908416 Unable to complete SCIM call.
Traceback (most recent call last):
File "[...]/site-packages/django_scim/views.py", line 90, in dispatch
return super(SCIMView, self).dispatch(request, *args, **kwargs)
File "[...]/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "[...]/site-packages/django_scim/views.py", line 246, in get
return self.get_many(request)
File "[...]/site-packages/django_scim/views.py", line 262, in get_many
extra_filter_kwargs = self.get_extra_filter_kwargs(request)
File "[...]/site-packages/django_scim/views.py", line 47, in get_extra_filter_kwargs
return get_extra_model_filter_kwargs_getter(self.model_cls)
File "[...]/site-packages/django_scim/views.py", line 43, in model_cls
return self.class.model_cls_getter()
TypeError: unbound method get_user_model() must be called with UsersView instance as first argument (got nothing instead)
[2019/04/14 13:26:16] HTTP GET /scim/v2/Users 500 [0.34, 127.0.0.1:42578]

Is this perhaps an issue for Python2 only?

@erfaan
Copy link

erfaan commented Apr 17, 2019

model_cls_getter = get_user_model
Whenever you assign a function to a class object, it becomes a method in python2.

You can retrieve the function object from the unbound method by accessing its im_func attribute. Change views.SCIMView.model_cls to return:

self.__class__.model_cls_getter.im_func()

@pablodiazgutierrez
Copy link
Contributor Author

Thanks @erfaan, I've patched this in #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants