request: Refactor ZulipRequestNotes to RequestNotes.

This utilizes the generic `BaseNotes` we added for multipurpose
patching. With this migration as an example, we can further support
more types of notes to replace the monkey-patching approach we have used
throughout the codebase for type safety.
This commit is contained in:
PIG208
2021-08-22 01:24:20 +08:00
committed by Tim Abbott
parent dba7b1e3a7
commit 53888e5a26
32 changed files with 124 additions and 124 deletions

View File

@@ -42,10 +42,10 @@ class RateLimitedObject(ABC):
)
def rate_limit_request(self, request: HttpRequest) -> None:
from zerver.lib.request import get_request_notes
from zerver.lib.request import RequestNotes
ratelimited, time = self.rate_limit()
request_notes = get_request_notes(request)
request_notes = RequestNotes.get_notes(request)
request_notes.ratelimits_applied.append(
RateLimitResult(