D2168: mail: import email.utils not email.Utils
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Feb 12 03:45:26 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2168
AFFECTED FILES
mercurial/mail.py
CHANGE DETAILS
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -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
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list