authenticate: Remove default values for required parameters.

It is now the caller’s responsibility to check that realm is not None.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-05-04 16:04:48 -07:00
committed by Tim Abbott
parent 725582850f
commit 082f23a659
4 changed files with 40 additions and 64 deletions

View File

@@ -261,12 +261,11 @@ def remote_user_sso(request: HttpRequest,
subdomain = get_subdomain(request)
try:
realm = get_realm(subdomain) # type: Optional[Realm]
realm = get_realm(subdomain)
except Realm.DoesNotExist:
realm = None
# Since RemoteUserBackend will return None if Realm is None, we
# don't need to check whether `realm` is None.
user_profile = authenticate(remote_user=remote_user, realm=realm)
user_profile = None
else:
user_profile = authenticate(remote_user=remote_user, realm=realm)
redirect_to = request.GET.get('next', '')