]> granicus.if.org Git - python/commitdiff
parseaddr(): Don't use rfc822.parseaddr() because this now implies a
authorBarry Warsaw <barry@python.org>
Mon, 15 Apr 2002 22:00:25 +0000 (22:00 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 15 Apr 2002 22:00:25 +0000 (22:00 +0000)
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.

Lib/email/Utils.py

index f8e48ef4f9498e034672d23d7e6cb94891efe602..927d67eccca22380f76f7c611861790b84893460 100644 (file)
@@ -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]