From 229e08c1d964a917386e8bced7a6630b377d1d94 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 23 Jun 2020 13:36:55 -0700 Subject: [PATCH] backends: Fix a type: ignore issue. I checked that this does not interfere with the MRO of the auth backends: In [1]: import zproject.backends; zproject.backends.GitHubAuthBackend.__mro__ Out[1]: (zproject.backends.GitHubAuthBackend, zproject.backends.SocialAuthMixin, zproject.backends.ZulipAuthMixin, zproject.backends.ExternalAuthMethod, abc.ABC, social_core.backends.github.GithubOAuth2, social_core.backends.oauth.BaseOAuth2, social_core.backends.oauth.OAuthAuth, social_core.backends.base.BaseAuth, object) Signed-off-by: Anders Kaseorg --- zproject/backends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zproject/backends.py b/zproject/backends.py index 7e94d541fc..ba888f332b 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -1364,7 +1364,7 @@ def social_auth_finish(backend: Any, # then call login_or_register_remote_user. return redirect_and_log_into_subdomain(result) -class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod): +class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod, BaseAuth): # Whether we expect that the full_name value obtained by the # social backend is definitely how the user should be referred to # in Zulip, which in turn determines whether we should always show @@ -1388,7 +1388,7 @@ class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod): """ try: # Call the auth_complete method of social_core.backends.oauth.BaseOAuth2 - return super().auth_complete(*args, **kwargs) # type: ignore[misc] # monkey-patching + return super().auth_complete(*args, **kwargs) except (AuthFailed, HTTPError) as e: # When a user's social authentication fails (e.g. because # they did something funny with reloading in the middle of