mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
python: Close opened files.
Fixes various instances of ‘ResourceWarning: unclosed file’ with python -Wd. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
bb2db31f29
commit
31d0141a30
@@ -37,7 +37,8 @@ From image editing program:
|
||||
"""
|
||||
|
||||
def set_avatar(self, user: UserProfile, filename: str) -> None:
|
||||
upload_avatar_image(open(filename, 'rb'), user, user)
|
||||
with open(filename, 'rb') as f:
|
||||
upload_avatar_image(f, user, user)
|
||||
do_change_avatar_fields(user, UserProfile.AVATAR_FROM_USER, acting_user=None)
|
||||
|
||||
def add_message_formatting_conversation(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user