##// END OF EJS Templates
mail: convert addr to str early in addrlistencode()
Denis Laxalde -
r43977:599e25ad default
parent child Browse files
Show More
@@ -400,15 +400,15 b' def addrlistencode(ui, addrs, charsets=N'
400 '''Turns a list of addresses into a list of RFC-2047 compliant headers.
400 '''Turns a list of addresses into a list of RFC-2047 compliant headers.
401 A single element of input list may contain multiple addresses, but output
401 A single element of input list may contain multiple addresses, but output
402 always has one address per item'''
402 always has one address per item'''
403 straddrs = []
403 for a in addrs:
404 for a in addrs:
404 assert isinstance(a, bytes), '%r unexpectedly not a bytestr' % a
405 assert isinstance(a, bytes), '%r unexpectedly not a bytestr' % a
406 straddrs.append(encoding.strfromlocal(a))
405 if display:
407 if display:
406 return [encoding.strfromlocal(a.strip()) for a in addrs if a.strip()]
408 return [a.strip() for a in straddrs if a.strip()]
407
409
408 result = []
410 result = []
409 for name, addr in email.utils.getaddresses(
411 for name, addr in email.utils.getaddresses(straddrs):
410 [encoding.strfromlocal(a) for a in addrs]
411 ):
412 if name or addr:
412 if name or addr:
413 r = _addressencode(ui, name, encoding.strtolocal(addr), charsets)
413 r = _addressencode(ui, name, encoding.strtolocal(addr), charsets)
414 result.append(r)
414 result.append(r)
General Comments 0
You need to be logged in to leave comments. Login now