Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
decorator: Type zulip_login_required with overload.
PIG208f280ebe4b594
diff --git a/zerver/decorator.py b/zerver/decorator.pyindex 6555478add2..8518225ffda 100644--- a/zerver/decorator.py+++ b/zerver/decorator.py@@ -4,7 +4,7 @@ import loggingimport urllibfrom functools import wrapsfrom io import BytesIO-from typing import Callable, Dict, Optional, Sequence, Tuple, TypeVar, Union, cast+from typing import Callable, Dict, Optional, Sequence, Tuple, TypeVar, Union, cast, overloadimport django_otpfrom django.conf import settings@@ -474,6 +474,24 @@ def human_users_only(view_func: ViewFuncT) -> ViewFuncT:return cast(ViewFuncT, _wrapped_view_func) # https://github.com/python/mypy/issues/1927+@overload+def zulip_login_required(+ function: ViewFuncT,+ redirect_field_name: str = REDIRECT_FIELD_NAME,+ login_url: str = settings.HOME_NOT_LOGGED_IN,+) -> ViewFuncT:+ ...+++@overload+def zulip_login_required(+ function: None,+ redirect_field_name: str = REDIRECT_FIELD_NAME,+ login_url: str = settings.HOME_NOT_LOGGED_IN,+) -> Callable[[ViewFuncT], ViewFuncT]:+ ...++# Based on Django 1.8's @login_requireddef zulip_login_required(function: Optional[ViewFuncT] = None,