[Python-checkins] python/dist/src/Lib/email Utils.py,1.11,1.12

bwarsaw@sourceforge.net bwarsaw@sourceforge.net
Mon, 15 Apr 2002 15:00:28 -0700


Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv7956

Modified Files:
	Utils.py 
Log Message:
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.


Index: Utils.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Utils.py	12 Apr 2002 20:50:05 -0000	1.11
--- Utils.py	15 Apr 2002 22:00:25 -0000	1.12
***************
*** 21,25 ****
  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
--- 21,24 ----
***************
*** 238,243 ****
  
  def parseaddr(addr):
!     realname, emailaddr = _parseaddr(addr)
!     if realname == '' and emailaddr is None:
          return '', ''
!     return realname, emailaddr
--- 237,242 ----
  
  def parseaddr(addr):
!     addrs = _AddressList(addr).addresslist
!     if not addrs:
          return '', ''
!     return addrs[0]