From 1144eed48b1e2fe293499db50982af432eadd801 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 14 Aug 2017 15:41:04 -0700 Subject: [PATCH] decorator: Clean up 'profile' variable reuse. --- zerver/decorator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zerver/decorator.py b/zerver/decorator.py index 7f594dff24..2fbcb71d38 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -185,15 +185,15 @@ def validate_api_key(request, role, api_key, is_webhook=False): if settings.ZILENCER_ENABLED and is_remote_server(role): try: - profile = get_remote_server_by_uuid(role) # type: Union[UserProfile, RemoteZulipServer] + remote_server = get_remote_server_by_uuid(role) except RemoteZulipServer.DoesNotExist: raise JsonableError(_("Invalid Zulip server: %s") % (role,)) - if api_key != profile.api_key: + if api_key != remote_server.api_key: raise JsonableError(_("Invalid API key")) if not check_subdomain(get_subdomain(request), ""): raise JsonableError(_("This API key only works on the root subdomain")) - return profile + return remote_server try: profile = get_user_profile_by_email(role)