summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-04-15 22:00:25 (GMT)
committerBarry Warsaw <barry@python.org>2002-04-15 22:00:25 (GMT)
commit24fd0252c474bb1e4189dd6b92e572343f27f0f9 (patch)
tree412dfe3a9ccce478754c2f314bb9d60ab6db38d8 /Lib
parent0e0b6180ba2f85d54bdaeb4c36aac8bb01dd1759 (diff)
downloadcpython-24fd0252c474bb1e4189dd6b92e572343f27f0f9.zip
cpython-24fd0252c474bb1e4189dd6b92e572343f27f0f9.tar.gz
cpython-24fd0252c474bb1e4189dd6b92e572343f27f0f9.tar.bz2
parseaddr(): Don't use rfc822.parseaddr() because this now implies a
double call to AddressList.getaddrlist(), and /that/ always returns an empty list for the second and subsequent calls. Instead, instantiate an AddressList directly, and get the parsed addresses out of the addresslist attribute.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/Utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/email/Utils.py b/Lib/email/Utils.py
index f8e48ef..927d67e 100644
--- a/Lib/email/Utils.py
+++ b/Lib/email/Utils.py
@@ -20,7 +20,6 @@ from rfc822 import mktime_tz
# We need wormarounds for bugs in these methods in older Pythons (see below)
from rfc822 import parsedate as _parsedate
from rfc822 import parsedate_tz as _parsedate_tz
-from rfc822 import parseaddr as _parseaddr
from quopri import decodestring as _qdecode
import base64
@@ -237,7 +236,7 @@ def parsedate_tz(data):
def parseaddr(addr):
- realname, emailaddr = _parseaddr(addr)
- if realname == '' and emailaddr is None:
+ addrs = _AddressList(addr).addresslist
+ if not addrs:
return '', ''
- return realname, emailaddr
+ return addrs[0]