changeset 43322:7d912413a3ae stable

py3: use as_bytes() method of EmailMessage In Python 3, as_bytes() corresponds to as_string() in Python 2.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 10 Oct 2019 13:48:30 +0200
parents a2ff3aff81d2
children 84c15836a2d7
files hgext/notify.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/notify.py	Wed Oct 23 23:00:58 2019 +0100
+++ b/hgext/notify.py	Thu Oct 10 13:48:30 2019 +0200
@@ -440,7 +440,7 @@
             msg[r'Message-Id'] = messageid(ctx, self.domain, self.messageidseed)
         msg[r'To'] = encoding.strfromlocal(b', '.join(sorted(subs)))
 
-        msgtext = encoding.strtolocal(msg.as_string())
+        msgtext = msg.as_bytes() if pycompat.ispy3 else msg.as_string()
         if self.test:
             self.ui.write(msgtext)
             if not msgtext.endswith(b'\n'):