From 71afacbbcb5cc64a7f91576f7e849c93e90858c8 Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Tue, 5 Feb 2019 13:39:50 +0100 Subject: [PATCH] Fix infinite loop when not logged in. --- util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util.py b/util.py index 3b35ffc..352ed57 100644 --- a/util.py +++ b/util.py @@ -1,5 +1,6 @@ import shutil import textwrap +from commands.login import login from typing import Any, Callable from config import Config @@ -25,8 +26,9 @@ def print_wrap(text: str, indent: str = '', end: str = '\n') -> None: def require_login(function: Callable) -> Callable: def wrapper(*args: Any, **kwargs: Any) -> Any: - while 'api_token' not in Config['user']: + if 'api_token' not in Config['user']: print('Not logged in. Please use the login command to log in.') + return return function(*args, **kwargs)