Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
exceptions: Accept lazy translation as JsonableError argument.
Anders Kaseorgb85cb1e7004b
diff --git a/zerver/lib/exceptions.py b/zerver/lib/exceptions.pyindex ffa356da429..7abcdbae030 100644--- a/zerver/lib/exceptions.py+++ b/zerver/lib/exceptions.py@@ -1,8 +1,9 @@from enum import Enum, auto-from typing import Any, Dict, List, Optional, Tuple+from typing import Any, Dict, List, Optional, Tuple, Unionfrom django.core.exceptions import ValidationErrorfrom django.utils.translation import gettext as _+from django_stubs_ext import StrPromiseclass ErrorCode(Enum):@@ -85,9 +86,9 @@ class JsonableError(Exception):# like 403 or 404.http_status_code: int = 400- def __init__(self, msg: str) -> None:+ def __init__(self, msg: Union[str, StrPromise]) -> None:# `_msg` is an implementation detail of `JsonableError` itself.- self._msg: str = msg+ self._msg = msg@staticmethoddef msg_format() -> str: