Skip to content

Commit

Permalink
1.7.1dev: merge [17829] from 1.6-stable
Browse files Browse the repository at this point in the history
git-svn-id: http://trac.edgewall.org/intertrac/log:/trunk@17830 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information
jomae committed Jun 25, 2024
2 parents 17e6d06 + 78185ae commit 3a8724c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions trac/tests/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
import re
import threading
import unittest
from email.header import decode_header as _email_decode_header
from email.header import (
decode_header as _email_decode_header,
make_header as _email_make_header,
)

try:
from ._aiosmtpd import SMTPThreadedServer
Expand Down Expand Up @@ -86,14 +89,7 @@ def strip_address(address):

def decode_header(header):
""" Decode a MIME-encoded header value """
l = []
for s, charset in _email_decode_header(header):
if charset:
s = str(s, charset)
elif isinstance(s, bytes):
s = str(s, 'utf-8')
l.append(s)
return ''.join(l)
return str(_email_make_header(_email_decode_header(header)))


def parse_smtp_message(msg, decode=True):
Expand Down

0 comments on commit 3a8724c

Please sign in to comment.