django-allauth failures, but only for some users (independent of browser?)
Django-allauth seems to just be a basket of woes, but I figured I'd toss this one out there to see if anyone has seen similar:
I have Google and Facebook social logins configured. They work fine for me. They work fine for most people. Huzzah!
For some people, even when they use different browsers/OSes/etc, attempting a social login generates an error. On the callback, they get "Server error" "An error occurred while processing your request."
These errors are generated to me as the admin, and in the elided environment section SITE_ID is indeed 0, but I'm at a loss to imagine why this happens only sometimes!
Any pointers for investigation?
--Jered
Internal Server Error: /accounts/google/login/callback/
ImproperlyConfigured at /accounts/google/login/callback/ 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. [...] Traceback (most recent call last): File "/opt/app-root/src/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 56, in inner response = get_response(request) File "/opt/app-root/src/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 84, in view return self.dispatch(request, *args, **kwargs) File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 162, in dispatch return complete_social_login(request, login) File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/helpers.py", line 197, in complete_social_login sociallogin.lookup() File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 282, in lookup provider_id = self.account.get_provider().id File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 141, in get_provider provider = self._provider = adapter.get_provider( File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 204, in get_provider app = self.get_app(request, provider=provider) File "/opt/app-root/src/.local/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/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/adapter.py", line 231, in list_apps db_apps = SocialApp.objects.on_site(request) File "/opt/app-root/src/.local/lib/python3.9/site-packages/allauth/socialaccount/models.py", line 27, in on_site site = get_current_site(request) File "/opt/app-root/src/.local/lib/python3.9/site-packages/django/contrib/sites/shortcuts.py", line 16, in get_current_site return Site.objects.get_current(request) File "/opt/app-root/src/.local/lib/python3.9/site-packages/django/contrib/sites/models.py", line 63, in get_current raise ImproperlyConfigured(
Exception Type: ImproperlyConfigured at /accounts/google/login/callback/ Exception Value: 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. Raised during: allauth.socialaccount.providers.oauth2.views.view [... internal state elided ...]
On 12/6/23 11:00, Jered Floyd wrote:
These errors are generated to me as the admin, and in the elided environment section SITE_ID is indeed 0, but I'm at a loss to imagine why this happens only sometimes!
For me, on a test installation with SITE_ID = 0, this only occurs at https://example.com/accounts/social/connections/
Other URLs such as https://example.com/accounts/password/change/ and https://example.com/accounts/email/ do not throw this exception.
Here's the code:
def get_current(self, request=None):
"""
Return the current Site based on the SITE_ID in the project's
settings.
If SITE_ID isn't defined, return the site with domain matching
request.get_host(). The ``Site`` object is cached the first
time it's
retrieved from the database.
"""
from django.conf import settings
if getattr(settings, "SITE_ID", ""):
site_id = settings.SITE_ID
return self._get_site_by_id(site_id)
elif request:
return self._get_site_by_request(request)
raise 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."
)
I tried patching it from
if getattr(settings, "SITE_ID", ""):
to
if getattr(settings, "SITE_ID", None) is not None:
but that's even worse. It throws a bunch of "django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist." errors.
Somehow, get_current is being called without a request object in the cases where it fails.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
I'll dig at that; thanks.
I've just managed to get one of my Google accounts into this "broken" state, although I'm not entirely sure how I did it (or where the broken state is stored).
This happened after I tried using the "Sign In" button on a list info page rather than the one in the upper right corner, but that may just be a red herring.
I'll report back if I find anything.
--Jered
----- On Dec 6, 2023, at 3:21 PM, Mark Sapiro mark@msapiro.net wrote:
On 12/6/23 11:00, Jered Floyd wrote:
These errors are generated to me as the admin, and in the elided environment section SITE_ID is indeed 0, but I'm at a loss to imagine why this happens only sometimes!
For me, on a test installation with SITE_ID = 0, this only occurs at https://example.com/accounts/social/connections/
Other URLs such as https://example.com/accounts/password/change/ and https://example.com/accounts/email/ do not throw this exception.
Here's the code:
def get_current(self, request=None): """ Return the current Site based on the SITE_ID in the project's settings. If SITE_ID isn't defined, return the site with domain matching request.get_host(). The ``Site`` object is cached the first time it's retrieved from the database. """ from django.conf import settings if getattr(settings, "SITE_ID", ""): site_id = settings.SITE_ID return self._get_site_by_id(site_id) elif request: return self._get_site_by_request(request) raise 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." )
I tried patching it from
if getattr(settings, "SITE_ID", ""):
to
if getattr(settings, "SITE_ID", None) is not None:
but that's even worse. It throws a bunch of "django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist." errors.
Somehow, get_current is being called without a request object in the cases where it fails.
-- 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
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 Patch also included below. --Jered --- a/allauth/socialaccount/helpers.py +++ b/allauth/socialaccount/helpers.py @@ -205,7 +205,7 @@ def _add_social_account(request, sociallogin): def complete_social_login(request, sociallogin): assert not sociallogin.is_existing - sociallogin.lookup() + sociallogin.lookup(request) try: get_adapter().pre_social_login(request, sociallogin) signals.pre_social_login.send( --- a/allauth/socialaccount/models.py +++ b/allauth/socialaccount/models.py @@ -274,12 +274,12 @@ class SocialLogin(object): return False return get_user_model().objects.filter(pk=self.user.pk).exists() - def lookup(self): + def lookup(self, request=None): """Look up the existing local user account to which this social login points, if any. """ if not self._lookup_by_socialaccount(): - provider_id = self.account.get_provider().id + provider_id = self.account.get_provider(request).id if app_settings.EMAIL_AUTHENTICATION or app_settings.PROVIDERS.get( provider_id, {} ).get("EMAIL_AUTHENTICATION", False): ----- On Dec 6, 2023, at 3:21 PM, Mark Sapiro mark@msapiro.net wrote:
On 12/6/23 11:00, Jered Floyd wrote:
These errors are generated to me as the admin, and in the elided environment section SITE_ID is indeed 0, but I'm at a loss to imagine why this happens only sometimes!
For me, on a test installation with SITE_ID = 0, this only occurs at https://example.com/accounts/social/connections/
Other URLs such as https://example.com/accounts/password/change/ and https://example.com/accounts/email/ do not throw this exception.
Here's the code: ``` def get_current(self, request=None): """ Return the current Site based on the SITE_ID in the project's settings. If SITE_ID isn't defined, return the site with domain matching request.get_host(). The ``Site`` object is cached the first time it's retrieved from the database. """ from django.conf import settings
if getattr(settings, "SITE_ID", ""): site_id = settings.SITE_ID return self._get_site_by_id(site_id) elif request: return self._get_site_by_request(request)
raise 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." ) ```
I tried patching it from ``` if getattr(settings, "SITE_ID", ""): ``` to ``` if getattr(settings, "SITE_ID", None) is not None: ``` but that's even worse. It throws a bunch of "django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist." errors.
Somehow, get_current is being called without a request object in the cases where it fails.
-- 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
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
I'm able to reproduce this and will look into it -- what version of django-allauth are you using? (And what is the expected behavior for that endpoint?)
--Jered
----- 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
On 12/6/23 19:06, Jered Floyd wrote:
I'm able to reproduce this and will look into it -- what version of django-allauth are you using? (And what is the expected behavior for that endpoint?)
Django-allauth 0.58.2
The expected response is something like
User profile for mark
Account
Change Password
E-mail Addresses
Account Connections
Delete Account
You can sign in to your account using any of the following third party accounts: Facebook: Mark Sapiro GitHub: Mark Sapiro LinkedIn: Mark Sapiro GitLab: Mark Sapiro Google: Mark Sapiro Add a 3rd Party Account
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
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
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
On 12/7/23 14:33, Jered Floyd wrote:
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
Thank you again for your work on this. I can confirm that the patch below fixes my issue with https://msapiro.net/accounts/social/connections/ and SITE_ID = 0.
--- 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:
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
You're welcome. Thank you for all your hard work making Mailman 3 happen at all! I think django_allauth integration is again stable, but for now I'm pinning 0.58.2 + this patch. I'll test again once there is another release notification, but since I rebuild by container image every 2-3 weeks I am getting exhausted by surprises... --Jered ----- On Dec 7, 2023, at 7:44 PM, Mark Sapiro mark@msapiro.net wrote:
On 12/7/23 14:33, Jered Floyd wrote:
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
Thank you again for your work on this. I can confirm that the patch below fixes my issue with https://msapiro.net/accounts/social/connections/ and SITE_ID = 0.
--- 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:
-- 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
FYI, django-allauth 0.59.0 was released on December 12 and incorporates the patches to work properly with Mailman again. The only other issue is formatting of the login page. As I noted previously, this can be fixed by copying site-packages/allauth/templates/socialaccount/login.html to site-packages/django_mailman3/templates/socialaccount/login.html and changing the first line from: {% extends "socialaccount/base_entrance.html" %} to {% extends "django_mailman3/profile/base.html" %} --Jered ----- On Dec 7, 2023, at 9:57 PM, Jered Floyd jered@convivian.com wrote:
You're welcome. Thank you for all your hard work making Mailman 3 happen at all!
I think django_allauth integration is again stable, but for now I'm pinning 0.58.2 + this patch. I'll test again once there is another release notification, but since I rebuild by container image every 2-3 weeks I am getting exhausted by surprises...
--Jered
----- On Dec 7, 2023, at 7:44 PM, Mark Sapiro mark@msapiro.net wrote:
On 12/7/23 14:33, Jered Floyd wrote:
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
Thank you again for your work on this. I can confirm that the patch below fixes my issue with https://msapiro.net/accounts/social/connections/ and SITE_ID = 0.
--- 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:
-- 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
On 12/20/23 7:27 PM, Jered Floyd wrote:
FYI, django-allauth 0.59.0 was released on December 12 and incorporates the patches to work properly with Mailman again.
django-allauth 0.59.0 requires django.contrib.humanize in INSTALLED_APPS. You may need to add this in your Django settings when upgrading django-allauth.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
This is only required for the new "user sessions" app which doesn't appear to be exposed within Mailman. (I agree it should be added, though.)
--Jered
----- On Dec 21, 2023, at 4:12 AM, Mark Sapiro mark@msapiro.net wrote:
On 12/20/23 7:27 PM, Jered Floyd wrote:
FYI, django-allauth 0.59.0 was released on December 12 and incorporates the patches to work properly with Mailman again.
django-allauth 0.59.0 requires django.contrib.humanize in INSTALLED_APPS. You may need to add this in your Django settings when upgrading django-allauth.
-- 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
On 12/22/23 7:06 AM, Jered Floyd wrote:
This is only required for the new "user sessions" app which doesn't appear to be exposed within Mailman. (I agree it should be added, though.)
The issue is allauth/templates/usersessions/usersession_list.html
contains {% load humanize %} which causes compress
to fail if
humanize
isn't in INSTALLED_APPS.
This has all been committed. See https://gitlab.com/mailman/django-mailman3/-/merge_requests/243
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Jered Floyd
-
Mark Sapiro