changeset 36120:54dfb65e2f82

mail: import email.utils not email.Utils email.Utils was renamed to email.utils in Python 2.5. But it appears at some point before Python 2.7 (possibly 2.5) email.Utils was aliased to the new home. So email.utils should be safe for all versions of Python we support. Differential Revision: https://phab.mercurial-scm.org/D2168
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 18:58:45 -0800
parents 6ea7f1c10c81
children 3a763d7f40e1
files mercurial/mail.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mail.py	Sun Feb 11 18:50:24 2018 -0800
+++ b/mercurial/mail.py	Sun Feb 11 18:58:45 2018 -0800
@@ -288,13 +288,13 @@
             addr = addr.encode('ascii')
         except UnicodeDecodeError:
             raise error.Abort(_('invalid local address: %s') % addr)
-    return email.Utils.formataddr((name, addr))
+    return email.utils.formataddr((name, addr))
 
 def addressencode(ui, address, charsets=None, display=False):
     '''Turns address into RFC-2047 compliant header.'''
     if display or not address:
         return address or ''
-    name, addr = email.Utils.parseaddr(address)
+    name, addr = email.utils.parseaddr(address)
     return _addressencode(ui, name, addr, charsets)
 
 def addrlistencode(ui, addrs, charsets=None, display=False):
@@ -305,7 +305,7 @@
         return [a.strip() for a in addrs if a.strip()]
 
     result = []
-    for name, addr in email.Utils.getaddresses(addrs):
+    for name, addr in email.utils.getaddresses(addrs):
         if name or addr:
             result.append(_addressencode(ui, name, addr, charsets))
     return result