[Remail] [patch v2 05/11] remail: Simplify msg_set_header()
Thomas Gleixner
tglx at linutronix.de
Sun Jun 18 22:13:47 CEST 2023
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---
remail/mail.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
--- a/remail/mail.py
+++ b/remail/mail.py
@@ -195,12 +195,10 @@ re_rmlfcr = re.compile('[\r\n]')
# come with wreckaged headers.
txt = re_rmlfcr.sub(' ', txt)
- for k in msg.keys():
- if hdr.lower() == k.lower():
- msg.replace_header(k, txt)
- return
- # Not found set new
- msg[hdr] = txt
+ if msg.get(hdr):
+ msg.replace_header(hdr, txt)
+ else:
+ msg[hdr] = txt
payload_valid_mime_headers = [
'Content-Description',
More information about the Remail
mailing list