mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
We create a class called ZulipRequestNotes as a new home to all the additional attributes that we add to the Django HttpRequest object. This allows mypy to do the typecheck and also enforces type safety. Most of the attributes are added in the middleware, and thus it is generally safe to assert that they are not None in a code path that goes through the middleware. The caller is obligated to do manual the type check otherwise. This also resolves some cyclic dependencies that zerver.lib.request have with zerver.lib.rate_limiter and zerver.tornado.handlers.
19 KiB
19 KiB