iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.67k stars 314 forks source link

NameError: name 'get_adapter is not defined #286

Closed bjsvedin closed 8 months ago

bjsvedin commented 3 years ago

Steps to reproduce

This error occurs in forms.py, and only when 'allauth' is not installed. It looks like it was introduced on commit 82bd8b1, and released with 2.1.8

File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, *kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, args, kwargs) File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/views.py", line 248, in post serializer.is_valid(raise_exception=True) File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 220, in is_valid self._validated_data = self.run_validation(self.initial_data) File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 419, in run_validation value = self.to_internal_value(data) File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 478, in to_internal_value validated_value = validate_method(validated_value) File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/serializers.py", line 243, in validate_email if not self.reset_form.is_valid(): File "/usr/local/lib/python3.9/site-packages/django/forms/forms.py", line 175, in is_valid return self.is_bound and not self.errors File "/usr/local/lib/python3.9/site-packages/django/forms/forms.py", line 170, in errors self.full_clean() File "/usr/local/lib/python3.9/site-packages/django/forms/forms.py", line 372, in full_clean self._clean_fields() File "/usr/local/lib/python3.9/site-packages/django/forms/forms.py", line 393, in _cleanfields value = getattr(self, 'clean%s' % name)() File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/forms.py", line 27, in clean_email email = get_adapter().clean_email(email) NameError: name 'get_adapter' is not defined

surister commented 3 years ago

It was fixed here https://github.com/iMerica/dj-rest-auth/commit/3d210420fc37b940398c5e3500ddb9cf9e008613 but still not published in pypy, until it gets published versions 2.1.18 and 2.1.19 have a broken non allauth password reset.

Luctia commented 3 years ago

I would update to 2.1.10, but then I get #295...