FYI, The django-allauth author has proposed fixing both of these with an even simpler change, which is now upstream and queued for a future release. --Jered --- a/allauth/socialaccount/adapter.py +++ b/allauth/socialaccount/adapter.py @@ -228,7 +228,10 @@ class DefaultSocialAccountAdapter(object): provider_to_apps = {} # First, populate it with the DB backed apps. - db_apps = SocialApp.objects.on_site(request) + if request: + db_apps = SocialApp.objects.on_site(request) + else: + db_apps = SocialApp.objects.all() if provider: db_apps = db_apps.filter(Q(provider=provider) | Q(provider_id=provider)) if client_id: ----- On Dec 7, 2023, at 3:14 PM, Jered Floyd jered@convivian.com wrote:
This was a related issue. See https://github.com/pennersr/django-allauth/pull/3554
--Jered
--- a/allauth/socialaccount/models.py +++ b/allauth/socialaccount/models.py @@ -144,7 +144,7 @@ class SocialAccount(models.Model): return provider
def get_provider_account(self): - return self.get_provider().wrap_account(self) + return self.get_provider(context.request).wrap_account(self)
class SocialToken(models.Model):
----- On Dec 6, 2023, at 7:57 PM, Mark Sapiro mark@msapiro.net wrote:
On 12/6/23 14:49, Jered Floyd wrote:
The difference in behavior was using social login buttons for an existing account vs. creating a new account.
This is another damn django-allauth regression, starting in 0.57.0. It seem to be this commit that is to blame: https://github.com/pennersr/django-allauth/commit/be779dfee5a328a3a42edc2c95...
In allauth/socialaccount/models.py:lookup(self):285 there is an attempt to look up the social account as one that already exists. If that fails, this commit calls self.account.get_provider() without passing the request object, which leads to the eventual error.
I believe this is a django-allauth bug, and have submitted a pull request to fix it here: https://github.com/pennersr/django-allauth/pull/3548
Thanks for all your work on this. It is much appreciated. However, your patch doesn't fix my issue with the URL https://example.com/accounts/social/connections/ which still produces the following: ``` ERROR 2023-12-07 00:05:55,032 169452 django.request Internal Server Error: /accounts/social/connections/ Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 220, in _get_response response = response.render() File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/response.py", line 114, in render self.content = self.rendered_content File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/response.py", line 92, in rendered_content return template.render(context, self._request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 175, in render return self._render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render return compiled_parent._render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render return compiled_parent._render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 157, in render return compiled_parent._render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 167, in _render return self.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 63, in render result = block.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/loader_tags.py", line 63, in render result = block.nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py", line 321, in render return nodelist.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in render return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 1005, in <listcomp> return SafeString("".join([node.render_annotated(context) for node in self])) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py", line 238, in render nodelist.append(node.render_annotated(context)) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 966, in render_annotated return self.render(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py", line 539, in render values = {key: val.resolve(context) for key, val in self.extra_context.items()} File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/defaulttags.py", line 539, in <dictcomp> values = {key: val.resolve(context) for key, val in self.extra_context.items()} File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 715, in resolve obj = self.var.resolve(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 847, in resolve value = self._resolve_lookup(context) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/template/base.py", line 914, in _resolve_lookup current = current() File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 147, in get_provider_account return self.get_provider().wrap_account(self) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 141, in get_provider provider = self._provider = adapter.get_provider( File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 204, in get_provider app = self.get_app(request, provider=provider) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 284, in get_app apps = self.list_apps(request, provider=provider, client_id=client_id) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 231, in list_apps db_apps = SocialApp.objects.on_site(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 27, in on_site site = get_current_site(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/contrib/sites/shortcuts.py", line 16, in get_current_site return Site.objects.get_current(request) File "/opt/mailman/mm/venv/lib/python3.9/site-packages/django/contrib/sites/models.py", line 63, in get_current raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: You're using the Django "sites framework" without having set the SITE_ID setting. Create a site in your database and set the SITE_ID setting or pass a request to Site.objects.get_current() to fix this error. ```
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________ Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
This message sent to jered@convivian.com
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
This message sent to jered@convivian.com