Show More
@@ -288,13 +288,13 b' def _addressencode(ui, name, addr, chars' | |||
|
288 | 288 | addr = addr.encode('ascii') |
|
289 | 289 | except UnicodeDecodeError: |
|
290 | 290 | raise error.Abort(_('invalid local address: %s') % addr) |
|
291 |
return email. |
|
|
291 | return email.utils.formataddr((name, addr)) | |
|
292 | 292 | |
|
293 | 293 | def addressencode(ui, address, charsets=None, display=False): |
|
294 | 294 | '''Turns address into RFC-2047 compliant header.''' |
|
295 | 295 | if display or not address: |
|
296 | 296 | return address or '' |
|
297 |
name, addr = email. |
|
|
297 | name, addr = email.utils.parseaddr(address) | |
|
298 | 298 | return _addressencode(ui, name, addr, charsets) |
|
299 | 299 | |
|
300 | 300 | def addrlistencode(ui, addrs, charsets=None, display=False): |
@@ -305,7 +305,7 b' def addrlistencode(ui, addrs, charsets=N' | |||
|
305 | 305 | return [a.strip() for a in addrs if a.strip()] |
|
306 | 306 | |
|
307 | 307 | result = [] |
|
308 |
for name, addr in email. |
|
|
308 | for name, addr in email.utils.getaddresses(addrs): | |
|
309 | 309 | if name or addr: |
|
310 | 310 | result.append(_addressencode(ui, name, addr, charsets)) |
|
311 | 311 | return result |
General Comments 0
You need to be logged in to leave comments.
Login now