From 2070c8c102905a59b69f588d9e23bee19e14f277 Mon Sep 17 00:00:00 2001 From: Kristiyan Date: Fri, 9 Nov 2018 18:17:40 +0100 Subject: [PATCH] improve condition when failing api request, check if user exists, afterwards check if user is not active --- jupyterhub/handlers/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub/handlers/base.py b/jupyterhub/handlers/base.py index 802516f9..e03b3d06 100644 --- a/jupyterhub/handlers/base.py +++ b/jupyterhub/handlers/base.py @@ -1098,7 +1098,7 @@ class UserSpawnHandler(BaseHandler): # otherwise redirect users to their own server should_spawn = (current_user and current_user.name == user_name) - if "api" in user_path.split("/") and not user.active: + if "api" in user_path.split("/") and user and not user.active: # API request for not-running server (e.g. notebook UI left open) # Avoid triggering a spawn. self._fail_api_request(user)