Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tornado: Make handler_id an attribute on AsyncDjangoHandler.
Zixuan James Li56e1f3b7254a
diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.pyindex 410dcc1a28a..cd08e1c1eea 100644--- a/zerver/lib/test_helpers.py+++ b/zerver/lib/test_helpers.py@@ -287,7 +287,7 @@ def get_user_messages(user_profile: UserProfile) -> List[Message]:class DummyHandler(AsyncDjangoHandler):def __init__(self) -> None:- allocate_handler_id(self)+ self.handler_id = allocate_handler_id(self)dummy_handler = DummyHandler()diff --git a/zerver/tornado/handlers.py b/zerver/tornado/handlers.pyindex 94b1aaf6497..bf341cfdc27 100644--- a/zerver/tornado/handlers.py+++ b/zerver/tornado/handlers.py@@ -27,9 +27,9 @@ def get_handler_by_id(handler_id: int) -> "AsyncDjangoHandler":def allocate_handler_id(handler: "AsyncDjangoHandler") -> int:global current_handler_idhandlers[current_handler_id] = handler- handler.handler_id = current_handler_id+ handler_id = current_handler_idcurrent_handler_id += 1- return handler.handler_id+ return handler_iddef clear_handler_by_id(handler_id: int) -> None:@@ -90,7 +90,7 @@ class AsyncDjangoHandler(tornado.web.RequestHandler, base.BaseHandler):# Handler IDs are allocated here, and the handler ID map must# be cleared when the handler finishes its response- allocate_handler_id(self)+ self.handler_id = allocate_handler_id(self)def __repr__(self) -> str:descriptor = get_descriptor_by_handler_id(self.handler_id)