mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
request: Store client information using ZulipRequestNotes.
This concludes the HttpRequest migration to eliminate arbitrary attributes (except private ones that are belong to django) attached to the request object during runtime and migrated them to a separate data structure dedicated for the purpose of adding information (so called notes) to a HttpRequest.
This commit is contained in:
@@ -276,9 +276,13 @@ class ZulipWebhookFormatter(ZulipFormatter):
|
||||
)
|
||||
|
||||
header_message = header_text if header_text else None
|
||||
from zerver.lib.request import get_request_notes
|
||||
|
||||
client = get_request_notes(request).client
|
||||
assert client is not None
|
||||
|
||||
setattr(record, "user", f"{request.user.delivery_email} ({request.user.realm.string_id})")
|
||||
setattr(record, "client", request.client.name)
|
||||
setattr(record, "client", client.name)
|
||||
setattr(record, "url", request.META.get("PATH_INFO", None))
|
||||
setattr(record, "content_type", request.content_type)
|
||||
setattr(record, "custom_headers", header_message)
|
||||
|
||||
Reference in New Issue
Block a user