changeset 36435:f449138a52df

py3: use email.generator module instead of email.Generator On py2: >>> import email >>> import email.generator as emailgen >>> email.Generator.Generator is emailgen.Generator True email.Generator is not present on Python 3. Differential Revision: https://phab.mercurial-scm.org/D2454
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 26 Feb 2018 16:22:15 +0530
parents 1fb9e01328e4
children 4223bef1489c
files hgext/patchbomb.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Mon Feb 26 16:16:37 2018 +0530
+++ b/hgext/patchbomb.py	Mon Feb 26 16:22:15 2018 +0530
@@ -74,6 +74,7 @@
 from __future__ import absolute_import
 
 import email as emailmod
+import email.generator as emailgen
 import errno
 import os
 import socket
@@ -777,7 +778,7 @@
         if opts.get('test'):
             ui.status(_('displaying '), subj, ' ...\n')
             ui.pager('email')
-            generator = emailmod.Generator.Generator(ui, mangle_from_=False)
+            generator = emailgen.Generator(ui, mangle_from_=False)
             try:
                 generator.flatten(m, 0)
                 ui.write('\n')
@@ -794,7 +795,7 @@
                 # Exim does not remove the Bcc field
                 del m['Bcc']
             fp = stringio()
-            generator = emailmod.Generator.Generator(fp, mangle_from_=False)
+            generator = emailgen.Generator(fp, mangle_from_=False)
             generator.flatten(m, 0)
             sendmail(sender_addr, to + bcc + cc, fp.getvalue())