From 1e9c87855ccffd3374333f04fcdcba98de906954 Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Thu, 18 May 2017 14:42:19 +0500 Subject: [PATCH] Django 1.11: is_authenticated is now a property. --- zerver/decorator.py | 4 ++-- zerver/lib/rest.py | 2 +- zerver/views/auth.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/decorator.py b/zerver/decorator.py index d2720009af..49a83269c3 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -337,7 +337,7 @@ def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIE def logged_in_and_active(request): # type: (HttpRequest) -> bool - if not request.user.is_authenticated(): + if not request.user.is_authenticated: return False if not request.user.is_active: return False @@ -503,7 +503,7 @@ def process_as_post(view_func): def authenticate_log_and_execute_json(request, view_func, *args, **kwargs): # type: (HttpRequest, Callable[..., HttpResponse], *Any, **Any) -> HttpResponse - if not request.user.is_authenticated(): + if not request.user.is_authenticated: return json_error(_("Not logged in"), status=401) user_profile = request.user if not user_profile.is_active: diff --git a/zerver/lib/rest.py b/zerver/lib/rest.py index aad31790b3..c178b53413 100644 --- a/zerver/lib/rest.py +++ b/zerver/lib/rest.py @@ -89,7 +89,7 @@ def rest_dispatch(request, **kwargs): # This request API based authentication. target_function = authenticated_rest_api_view()(target_function) # /json views (web client) validate with a session token (cookie) - elif not request.path.startswith("/api") and request.user.is_authenticated(): + elif not request.path.startswith("/api") and request.user.is_authenticated: # Authenticated via sessions framework, only CSRF check needed target_function = csrf_protect(authenticated_json_view(target_function)) diff --git a/zerver/views/auth.py b/zerver/views/auth.py index d3bcb00763..77e807e0ec 100644 --- a/zerver/views/auth.py +++ b/zerver/views/auth.py @@ -424,7 +424,7 @@ def get_dev_users(extra_users_count=10): def login_page(request, **kwargs): # type: (HttpRequest, **Any) -> HttpResponse - if request.user.is_authenticated(): + if request.user.is_authenticated: return HttpResponseRedirect("/") if is_subdomain_root_or_alias(request) and settings.REALMS_HAVE_SUBDOMAINS: redirect_url = reverse('zerver.views.registration.find_my_team')