Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/taiga: Make EventType a TypedDict.
Niloth P9f8e613d93e6
diff --git a/zerver/webhooks/taiga/view.py b/zerver/webhooks/taiga/view.pyindex 71c57dec24c..1f153d3ad7f 100644--- a/zerver/webhooks/taiga/view.py+++ b/zerver/webhooks/taiga/view.py@@ -7,7 +7,7 @@ value should always be in bold; otherwise the subject of US/taskshould be in bold."""-from typing import TypeAlias+from typing import TypedDictfrom django.http import HttpRequest, HttpResponse@@ -18,7 +18,11 @@ from zerver.lib.validator import WildValue, check_bool, check_none_or, check_strfrom zerver.lib.webhooks.common import check_send_webhook_messagefrom zerver.models import UserProfile-EventType: TypeAlias = dict[str, str | dict[str, str | bool | None]]++class EventType(TypedDict):+ type: str+ event: str+ values: dict[str, str | bool | None]@webhook_view("Taiga")@@ -261,10 +265,7 @@ def parse_message(def generate_content(data: EventType) -> str:- assert isinstance(data["type"], str) and isinstance(data["event"], str)template = TEMPLATES[data["type"]][data["event"]]-- assert isinstance(data["values"], dict)content = template.format(**data["values"])return content