[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20220704-5-g4ef519f
Jon TURNEY via Cygwin-apps-cvs <[email protected]> Sat, 16 Jul 2022 19:12:33 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=4ef519f84b9da106f07677289f629787384cb469 commit 4ef519f84b9da106f07677289f629787384cb469 Author: Jon Turney <[email protected]> Date: Sat Jul 16 19:56:28 2022 +0100 Fix BufferingSMTPHandler used as a context Since a1cb1581, BufferingSMTPHandler was used directly as a context to send an unhandled exception termination report email, but that class doesn't support such use... Diff: --- calm/buffering_smtp_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/calm/buffering_smtp_handler.py b/calm/buffering_smtp_handler.py index 2d764ae..2cd1b63 100644 --- a/calm/buffering_smtp_handler.py +++ b/calm/buffering_smtp_handler.py @@ -99,3 +99,10 @@ class BufferingSMTPHandler(logging.handlers.BufferingHandler): def __enter__(self): logging.getLogger().addHandler(self) return self + + def __exit__(self, exception_type, exception_value, traceback): + self.close() + logging.getLogger().removeHandler(self) + + # process any exception in the with-block normally + return False