Thu, 24 Oct 2019 17:28:57 +0200 py3: fix generated non-ascii message in test-notify.t stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 17:28:57 +0200] rev 43331
py3: fix generated non-ascii message in test-notify.t The resulting "Subject:" header contains an encoded word in Python 3 so we have to add distinct outputs for Python 3 but underlying values are the same: >>> from email.header import decode_header >>> decode_header('=?utf-8?b?w6AuLi4=?=') [(b'\xc3\xa0...', 'utf-8')]
Thu, 24 Oct 2019 14:28:20 +0200 py3: decode encoding literal before passing to .decode() stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 14:28:20 +0200] rev 43330
py3: decode encoding literal before passing to .decode() bytes.decode(<encoding>) wants an str as "encoding" parameter, it raises a TypeError if given a bytestring. encoding.encoding and encoding.fallbackencoding are bytes values.
Thu, 24 Oct 2019 16:34:43 +0200 py3: decode payload of notify email stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 16:34:43 +0200] rev 43329
py3: decode payload of notify email This fixes one UnicodeEncodeError in test-notify.t:422 when testing the notify hook with non-ascii content (there are more later). We only decode on Python 3, since it's not safe for sure on Python 2.
Thu, 24 Oct 2019 15:50:15 +0200 py3: decode email headers with mail.headdecode() in notify extension stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:50:15 +0200] rev 43328
py3: decode email headers with mail.headdecode() in notify extension
Thu, 24 Oct 2019 15:46:16 +0200 py3: use stdlib's parseaddr() to get sender header in notify extension stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:46:16 +0200] rev 43327
py3: use stdlib's parseaddr() to get sender header in notify extension In Python 3, email headers are unicode string so using stringutil.email() will not work as it compares with bytestring. So let's use email.utils.parseaddr() from the stdlib which has a consistent behavior across Python versions. The same is done in patchbomb extension already.
Thu, 24 Oct 2019 15:28:00 +0200 py3: use a BytesParser in notify extension stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 15:28:00 +0200] rev 43326
py3: use a BytesParser in notify extension This is the first step to make the "long line" case in test-notify.t pass by fixing a UnicodeDecodeError on Python 3. We alias a parsebytes() in mail module, similarly as we already have a parse() function for Python 2 and Python 3 compatibility.
Thu, 24 Oct 2019 17:16:43 +0200 py3: fix headencode() with display=False stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 17:16:43 +0200] rev 43325
py3: fix headencode() with display=False We previously called str() on a email.header.Header object. On Python 2, this returns a bytestring and the __str__ method is actually an alias to .encode() method. On Python 3, __str__ does not perform encoding (and returns a unicode string). To keep a consistent behavior across Python versions, we explicitly use .encode() and we wrap the result with encoding.strtolocal() to get a bytestring in all cases. As a side effect of forcing bytes conversion, we need to decode back in _addressencode(). This is to make test-notify.t pass on Python 3. Also note that headers are now encoded in some patchbomb tests; this is because the charset is not always "us-ascii" ("iso-8859-1" otherwise) on Python 3.
Thu, 24 Oct 2019 14:31:24 +0200 mail: catch LookupError in headdecode() stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 14:31:24 +0200] rev 43324
mail: catch LookupError in headdecode() We already catch this exception in _encode() (called by headencode()). It gets raised when running test-notify.t with Python 3.
Thu, 24 Oct 2019 16:56:36 +0200 py3: account for extra line break in email headers in test-notify.t stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 24 Oct 2019 16:56:36 +0200] rev 43323
py3: account for extra line break in email headers in test-notify.t Long headers appears to be wrapped with new lines. In test-notify.t, we have a "filter.py" that replaces "\n" by " ", so we get an extra space in a Message-Id with a long value.
Thu, 10 Oct 2019 13:48:30 +0200 py3: use as_bytes() method of EmailMessage stable
Denis Laxalde <denis.laxalde@logilab.fr> [Thu, 10 Oct 2019 13:48:30 +0200] rev 43322
py3: use as_bytes() method of EmailMessage In Python 3, as_bytes() corresponds to as_string() in Python 2.
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 tip