[Python-checkins] python/dist/src/Lib smtplib.py,1.61,1.62
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Wed, 04 Sep 2002 18:14:10 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv15759
Modified Files:
smtplib.py
Log Message:
smptlib did not handle empty addresses.
The problem was that it expected rfc822.parseaddr() to return None
upon a parse failure. The actual, documented return value for a
parse failure is (None, None).
Closes SF bug 602029.
Index: smtplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** smtplib.py 8 Aug 2002 20:19:18 -0000 1.61
--- smtplib.py 5 Sep 2002 01:14:07 -0000 1.62
***************
*** 169,180 ****
Should be able to handle anything rfc822.parseaddr can handle.
"""
! m=None
try:
m=rfc822.parseaddr(addr)[1]
except AttributeError:
pass
! if not m:
#something weird here.. punt -ddm
! return addr
else:
return "<%s>" % m
--- 169,180 ----
Should be able to handle anything rfc822.parseaddr can handle.
"""
! m = (None, None)
try:
m=rfc822.parseaddr(addr)[1]
except AttributeError:
pass
! if m == (None, None): # Indicates parse failure or AttributeError
#something weird here.. punt -ddm
! return "<%s>" % addr
else:
return "<%s>" % m