[Python-checkins] r60975 - in python/trunk/Lib: smtplib.py test/test_smtplib.py
facundo.batista
python-checkins at python.org
Sat Feb 23 13:27:18 CET 2008
Author: facundo.batista
Date: Sat Feb 23 13:27:17 2008
New Revision: 60975
Modified:
python/trunk/Lib/smtplib.py
python/trunk/Lib/test/test_smtplib.py
Log:
Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
Modified: python/trunk/Lib/smtplib.py
==============================================================================
--- python/trunk/Lib/smtplib.py (original)
+++ python/trunk/Lib/smtplib.py Sat Feb 23 13:27:17 2008
@@ -298,7 +298,7 @@
def send(self, str):
"""Send `str' to the server."""
if self.debuglevel > 0: print>>stderr, 'send:', repr(str)
- if self.sock:
+ if hasattr(self, 'sock') and self.sock:
try:
self.sock.sendall(str)
except socket.error:
@@ -486,7 +486,7 @@
vrfy=verify
def expn(self, address):
- """SMTP 'verify' command -- checks for address validity."""
+ """SMTP 'expn' command -- expands a mailing list."""
self.putcmd("expn", quoteaddr(address))
return self.getreply()
Modified: python/trunk/Lib/test/test_smtplib.py
==============================================================================
--- python/trunk/Lib/test/test_smtplib.py (original)
+++ python/trunk/Lib/test/test_smtplib.py Sat Feb 23 13:27:17 2008
@@ -82,8 +82,9 @@
# to reference the nonexistent 'sock' attribute of the SMTP object
# causes an AttributeError)
smtp = smtplib.SMTP()
- self.assertRaises(AttributeError, smtp.ehlo)
- self.assertRaises(AttributeError, smtp.send, 'test msg')
+ self.assertRaises(smtplib.SMTPServerDisconnected, smtp.ehlo)
+ self.assertRaises(smtplib.SMTPServerDisconnected,
+ smtp.send, 'test msg')
def testLocalHostName(self):
# check that supplied local_hostname is used
More information about the Python-checkins
mailing list