cpython/Lib
Guido van Rossum 296e14301a Changes by Per Cederquist and The Dragon.
Per writes:

"""
The application where Signum Support uses smtplib needs to be able to
report good error messages to the user when sending email fails.  To
help in diagnosing problems it is useful to be able to report the
entire message sent by the server, not only the SMTP error code of the
offending command.

A lot of the functions in sendmail.py unfortunately discards the
message, leaving only the code.  The enclosed patch fixes that
problem.

The enclosed patch also introduces a base class for exceptions that
include an SMTP error code and error message, and make the code and
message available on separate attributes, so that surrounding code can
deal with them in whatever way it sees fit.  I've also added some
documentation to the exception classes.

The constructor will now raise an exception if it cannot connect to
the SMTP server.

The data() method will raise an SMTPDataError if it doesn't receive
the expected 354 code in the middle of the exchange.

According to section 5.2.10 of RFC 1123 a smtp client must accept "any
text, including no text at all" after the error code.  If the response
of a HELO command contains no text self.helo_resp will be set to the
empty string ("").  The patch fixes the test in the sendmail() method
so that helo_resp is tested against None; if it has the empty string
as value the sendmail() method would invoke the helo() method again.

The code no longer accepts a -1 reply from the ehlo() method in
sendmail().

[Text about removing SMTPRecipientsRefused deleted --GvR]
"""

and also:

"""
smtplib.py appends an extra blank line to the outgoing mail if the
`msg' argument to the sendmail method already contains a trailing
newline.  This patch should fix the problem.
"""

The Dragon writes:

"""
	Mostly I just re-added the SMTPRecipientsRefused exception
(the exeption object now has the appropriate info in it ) [Per had
removed this in his patch --GvR] and tweaked the behavior of the
sendmail method whence it throws the newly added SMTPHeloException (it
was closing the connection, which it shouldn't.  whatever catches the
exception should do that. )

	I pondered the change of the return values to tuples all around,
and after some thinking I decided that regularizing the return values was
too much of the Right Thing (tm) to not do.

	My one concern is that code expecting an integer & getting a tuple
may fail silently.

(i.e. if it's doing :

      x.somemethod() >= 400:
expecting an integer, the expression will always be true if it gets a
tuple instead. )

	However, most smtplib code I've seen only really uses the
sendmail() method, so this wouldn't bother it.  Usually code I've seen
that calls the other methods usually only calls helo() and ehlo() for
doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
and thus I would think not much code uses it yet.
"""
1999-04-07 15:03:39 +00:00
..
distutils Added all the "external action" methods (to make handling the verbose 1999-04-04 02:58:07 +00:00
dos-8x3 The usual 1999-02-16 20:05:35 +00:00
lib-old Dang. Even though this is obsolete code, somebody found a bug, and I 1999-02-22 15:19:47 +00:00
lib-stdwin Fixed conversion between seconds and milliseconds. 1996-12-12 23:42:20 +00:00
lib-tk Bug reported by Jim Robinson: 1999-03-16 21:54:50 +00:00
plat-aix3 New AIX specific subdirs 1996-08-08 18:24:58 +00:00
plat-aix4 New AIX specific subdirs 1996-08-08 18:24:58 +00:00
plat-beos Checking in BeOS specific socket module. 1998-08-10 20:15:32 +00:00
plat-freebsd2 New files from Thomas Gellekum 1998-05-06 15:14:36 +00:00
plat-freebsd3 New files from Thomas Gellekum 1998-05-06 15:14:36 +00:00
plat-generic Use fcntl.h instead of sys/fcntl.h; use h2py.py from Tools/scripts 1996-08-08 18:25:40 +00:00
plat-irix5 Remove stuff with unsure copyright status 1999-03-12 19:31:51 +00:00
plat-irix6 Remove stuff with unsure copyright status 1999-03-12 19:31:51 +00:00
plat-linux1 more recent linux header files 1996-01-26 17:43:46 +00:00
plat-linux2 Regenerated on a newer Linux version. 1997-05-09 02:21:06 +00:00
plat-netbsd1 More generated files for netbsd 1.x, by Anders Andersen. 1997-12-03 18:44:57 +00:00
plat-next3 regen for Next 1996-08-16 18:14:41 +00:00
plat-sunos4
plat-sunos5 Add two constants (with the same value) to specify the on-board CD input. 1998-09-24 18:09:47 +00:00
plat-win Added table of WSA error codes. 1998-05-06 13:48:04 +00:00
test Fix the tests now that splitdrive() no longer treats UNC paths special. 1999-04-06 19:38:18 +00:00
aifc.py [Sjoerd Mullender] 1998-08-07 15:28:23 +00:00
anydbm.py Oops, I had 'n' and 'c' mixed up in my mind. Get rid of the comment 1998-04-28 15:23:09 +00:00
asynchat.py A gift from Sam Rushing - modules asyncore and asynchat for the 1999-01-12 20:19:27 +00:00
asyncore.py A gift from Sam Rushing - modules asyncore and asynchat for the 1999-01-12 20:19:27 +00:00
audiodev.py Added support for 4-channel on SGI. 1996-12-13 00:19:56 +00:00
base64.py Fixed spelling in comment: "RFC", not "RFX". 1998-05-22 18:18:08 +00:00
BaseHTTPServer.py Per Cederqvist writes: 1999-03-30 20:17:31 +00:00
Bastion.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
bdb.py Embarrassing: remove a debug print statement from set_break() for the 1999-01-29 22:39:32 +00:00
binhex.py A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
bisect.py A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
builtin.py
calendar.py
cgi.py FieldStorage.__init__(): if there is no content-type header, use 1999-01-08 17:42:03 +00:00
CGIHTTPServer.py Patch by Jeff Rush: 1998-12-07 04:08:03 +00:00
cmd.py Patch by Michael Scharf. He writes: 1999-03-12 22:15:43 +00:00
cmp.py Use (f1, f2) as cache key instead of f1 + ' ' + f2. 1998-10-21 15:23:52 +00:00
cmpcache.py fix buffer size 1994-10-09 22:34:40 +00:00
code.py Moved compile_command() to a file of its own (codeop.py). 1998-10-22 21:56:44 +00:00
codeop.py Moved compile_command() here from code.py, so JPython can provide its 1998-10-22 21:56:15 +00:00
colorsys.py Oops, one more "x, y, z" to convert... 1999-02-25 14:26:02 +00:00
commands.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
compileall.py When run as a script, report failures in the exit code as well. 1999-03-29 20:25:40 +00:00
ConfigParser.py Fix by Chris Petrilli (to his own code) to limit the number of 1999-02-12 14:13:10 +00:00
copy.py Don't die if CodeType doesn't exist -- ignore the error. This could 1999-01-25 21:37:02 +00:00
copy_reg.py Added some minimal comments and tweaked lay-out a bit. 1997-05-20 18:03:22 +00:00
dbhash.py The permissions ('mode' flag) should default to 0666. 1998-07-03 14:16:55 +00:00
dircache.py
dircmp.py
dis.py Get rid of some obsolete opcodes. 1998-07-07 14:58:39 +00:00
dospath.py New code for split() by Tim Peters, behaves more like posixpath.split(). 1999-03-19 21:05:12 +00:00
dumbdbm.py export error == IOError 1996-05-28 22:58:40 +00:00
dump.py
exceptions.py Document the correct class hierarchy for SystemExit. It is not an 1999-02-24 00:27:39 +00:00
fileinput.py Add missing initializer for self._backupfilename. Due to Ralph Butler. 1998-07-20 15:49:28 +00:00
find.py changes for the Mac 1995-01-27 02:41:45 +00:00
fnmatch.py Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
formatter.py DumbWriter.send_paragraph(): Fix problem with DumbWriter reported to 1999-01-12 18:13:27 +00:00
fpformat.py re -> regex conversions by Sjoerd. 1997-10-24 14:46:16 +00:00
ftplib.py Add warning to Netrc's docstring that it is obsolete -- use the netrc 1998-12-22 16:49:16 +00:00
getopt.py Accept a non-list sequence for the long options (request by Jack Jansen). 1998-11-17 04:16:37 +00:00
getpass.py Mod by Jack Jansen: on Macintosh, use EasyDialogs.GetPassword if it 1999-02-11 14:41:46 +00:00
glob.py Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
gopherlib.py A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
grep.py Added pgrep() function, which is like grep/egrep/emgrep but uses Perl 1997-10-22 20:44:58 +00:00
gzip.py Oops, missed mode parameter to open(). 1999-04-05 18:37:59 +00:00
htmlentitydefs.py added &quot def 1996-05-28 23:18:55 +00:00
htmllib.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
httplib.py Patch by Tim O'Malley for servers that send a response looking just like 1998-01-19 22:25:24 +00:00
ihooks.py Support loading of packages. (I had this coded up for a while but 1998-06-29 20:31:16 +00:00
imaplib.py Piers Lauder writes: 1998-10-21 22:06:56 +00:00
imghdr.py Allow open file as parameter (must be seekable) (Jack) 1997-10-08 15:22:32 +00:00
keyword.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
knee.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
linecache.py don't print Cannot open/stat messages 1995-08-10 19:32:22 +00:00
locale.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
macpath.py Add abspath() 1999-01-29 18:05:18 +00:00
macstat.py
macurl2path.py Quote/unquote slashes in macintosh pathname components (Jack Jansen). 1998-08-06 13:37:21 +00:00
mailbox.py Add readlines() to _Subfile class. Not clear who would need it, but 1999-03-24 16:20:45 +00:00
mailcap.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Makefile Remove .pyo files like .pyc files. 1997-10-20 23:16:58 +00:00
mhlib.py Patch by Lars Wirzenius: 1999-02-24 16:25:17 +00:00
mimetools.py Use random instead of whrandom. 1998-05-20 17:05:52 +00:00
mimetypes.py Added .rdf and .xsl as application/xml types. (.rdf is for the 1999-03-11 16:04:04 +00:00
MimeWriter.py Run the self-test (test.test_MimeWriter) when invoked as a script. 1998-04-23 13:34:57 +00:00
mimify.py [Sjoerd Mullender] 1998-08-07 15:26:56 +00:00
multifile.py # Make tabnanny happy. 1998-06-29 17:58:43 +00:00
mutex.py Change to always call list.append with a single argument. 1996-10-08 14:06:17 +00:00
netrc.py Adding shlex and netrc by Eric Raymond. 1998-12-22 05:19:29 +00:00
newimp.py Official version 1.26 directly from Ken 1995-07-12 15:34:34 +00:00
nntplib.py Marc-Andre Lemburg notes about statparse(): 1998-12-21 18:51:23 +00:00
ntpath.py Withdraw the UNC support from splitdrive(). Instead, a new function 1999-04-06 19:32:19 +00:00
nturl2path.py Sjoerd Mullender writes: 1999-03-18 14:21:41 +00:00
os.py As Finn Bock points out, _P_WAIT etc. don't have a leading underscore 1999-02-22 15:40:34 +00:00
packmail.py Put quotes around the filename, so spaces in filenames work. 1998-04-28 16:03:03 +00:00
pdb.doc Untabified and applied Richard Wolff's changes (plus my own reflowing 1998-09-17 15:01:38 +00:00
pdb.py Improvement of b/w compat note in help text for clear, by Richard Wolff. 1999-01-28 14:38:32 +00:00
persist.py
pickle.py Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK 1999-03-25 21:58:59 +00:00
pipes.py Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
popen2.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
poplib.py There was a confusion in my checkin of the code to support list() with 1998-09-14 17:36:51 +00:00
posixfile.py According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the 1999-02-23 04:14:32 +00:00
posixpath.py Add abspath() 1999-01-29 18:05:18 +00:00
pprint.py _safe_repr(): Simplify the condition tests in the first possible 1999-02-17 17:30:52 +00:00
profile.doc
profile.py After the previous changes, func_normalize() turned out to be redundant. 1998-09-21 17:40:47 +00:00
pstats.py Give in to Timmy's Tedious Tab Theorem. 1998-03-23 15:31:22 +00:00
pty.py New tty/pty modules by Steen; new urlparser. 1994-09-12 10:36:35 +00:00
py_compile.py Fix two bugs in the fstat() line, reported by Fredruk Lundh. 1998-10-07 14:06:03 +00:00
pyclbr.py Bow to font-lock at the end of the docstring, since it throws stuff 1999-02-18 20:51:50 +00:00
Queue.py Tim Peters: 1999-02-08 18:34:01 +00:00
quopri.py A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
random.py Added randrange to list of exported functions. 1998-07-31 13:40:05 +00:00
re.py The .subn() method wasn't setting _num_regs, which is used by the .groups() 1998-08-21 18:39:38 +00:00
reconvert.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
regex_syntax.py Added "new" symbol defns for RE_ANSI_HEX and RE_NO_GNU_EXTENSIONS -- 1997-10-22 16:28:53 +00:00
regsub.py Store the current regex syntax along with the regular expression 1997-02-18 18:52:55 +00:00
repr.py use getattr() instead of eval(), fix string representations 1995-01-12 12:29:17 +00:00
rexec.py Get rid of the classes RModuleLoader and RModuleImporter -- these were 1998-09-21 14:53:26 +00:00
rfc822.py Message.getaddrlist(): This now handles multiple occurances of the 1999-01-14 19:59:58 +00:00
rlcompleter.py In completer(), return None instead of raising an IndexError when 1998-06-12 19:42:14 +00:00
robotparser.py Give in to tabnanny 1998-04-06 14:29:28 +00:00
sched.py
sgmllib.py Allow recognition of attributes even if they don't have space in front 1999-01-25 21:57:07 +00:00
shelve.py Give in to tabnanny. 1998-04-06 14:14:25 +00:00
shlex.py Bug reported by Tobias Thelen: missing "self." in assignment target. 1999-03-22 15:28:08 +00:00
shutil.py Add import sys, needed by reference to sys.exc_info() in rmtree(). 1999-02-23 23:07:51 +00:00
SimpleHTTPServer.py Patch by Jeff Rush: 1998-12-07 04:08:30 +00:00
site.py Wrong pathname in docstring detected by Fredrik Nehr. 1998-11-25 15:57:47 +00:00
smtplib.py Changes by Per Cederquist and The Dragon. 1999-04-07 15:03:39 +00:00
sndhdr.py Move brief descriptions of what() and whathdr() to docstrings in the 1999-01-06 15:20:49 +00:00
SocketServer.py Patch by Jeff Bauer: a minor change to declare two new 1998-11-30 15:07:01 +00:00
stat.py
statcache.py Use global statement instead of importing ourselves to get to global 1995-12-07 10:16:45 +00:00
statvfs.py Patch by Steve Clift -- fix the indices now that f_fsid is no longer returned! 1999-02-10 13:12:07 +00:00
string.py As Tim Peters points out, ``from string import *'' should not set re to None. 1998-04-20 14:01:00 +00:00
StringIO.py Raise the right exception (ValueError) for attempted I/O on closed StringIO 1998-08-18 17:43:08 +00:00
stringold.py As Tim Peters points out, ``from string import *'' should not set re to None. 1998-04-20 14:01:00 +00:00
sunau.py Should open files in binary mode! 1999-02-05 20:55:16 +00:00
sunaudio.py
symbol.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
tabnanny.py Added a -q ('quiet') option to tabnanny, which causes only the names of 1998-12-18 13:56:58 +00:00
telnetlib.py Added mt_interact() -- multithreaded version of interact(). 1998-12-23 23:04:17 +00:00
tempfile.py Improvement to the previous fix suggested by Thomas Bellman: if the 1998-10-24 15:02:59 +00:00
threading.py Get rid of tabnanny's last complaints. 1998-06-09 19:04:26 +00:00
threading_api.py The doc string for setDaemon() disagreed with the implementation. The 1998-08-07 19:15:20 +00:00
toaiff.py Use sndhdr instead of the obsolete whatsound module. 1999-02-24 18:49:15 +00:00
token.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
tokenize.py Differentiate between NEWLINE token (an official newline) and NL token 1998-04-03 16:05:38 +00:00
traceback.py Add obvious needed else clause to format_exception(). 1998-03-18 17:48:06 +00:00
tty.py New tty/pty modules by Steen; new urlparser. 1994-09-12 10:36:35 +00:00
turtle.py Turtle graphics 1998-12-04 16:42:46 +00:00
types.py Added BufferType, the type returned by the new builtin buffer(). Greg Stein. 1999-03-19 19:08:03 +00:00
tzparse.py Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
urllib.py Hack so that if a 302 or 301 redirect contains a relative URL, the 1999-03-29 20:23:41 +00:00
urlopen.py
urlparse.py Sjoerd Mullender writes: 1999-03-18 15:10:44 +00:00
user.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
UserDict.py Improved a bunch of things. 1999-03-26 15:31:12 +00:00
UserList.py Use isinstance() where appropriate. 1999-03-26 16:20:18 +00:00
util.py
uu.py Incorporate fix suggested by /Fredrik Lundh in the newsgroup to cope 1999-01-05 18:02:24 +00:00
wave.py Ehm, when we don't need to byteswap the data, don't go through an 1999-02-05 22:32:11 +00:00
whichdb.py Support byte-swapped dbhash (bsddb) files. Found by Ben Sayer. 1998-04-28 15:41:03 +00:00
whrandom.py Fixed a few lines that tabnanny complained about (one space before the 1998-08-10 20:07:53 +00:00
xdrlib.py Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
xmllib.py Fredrik Lundh fixes Sjoerd's patch... 1999-02-02 22:15:24 +00:00