This is a behavior change: before this leading and trailing spaces were
stripped from ASCII parts, now they are preserved. Without this fix we didn't
parse the examples in the RFC correctly, so I think breaking backward
compatibility here is justified.
Patch by Ralf Schlatterbeck.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.
(Oh, and I don't know if the compiler package works.)
present and the caller has not specified a name/password pair. This change
makes it less likely that a lazy coder will expose sensitive information in a
word-readable script.
Also, make the test a bit smarter. If NNTPSERVER is defined in the environment
it will go talk to that server rather than look for a possibly nonexistent
local one named 'news'. Maybe the osession initializer ought to look at
NNTPSERVER rather than requiring a host arg? Must look around and see how
universal this convention is first.
I modified nntplib so the body method can accept an
optional second parameter pointing to a filehandle or
filename (string). This way, really long body
articles can be stored to disk instead of kept in
memory. The way I made the modification should make
it easy to extend this functionality to other extended
return methods.
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
NNTPError - derived from Exception, it's the base class for all
other exceptions in this module
NNTPReplyError - what used to be error_reply
NNTPTemporaryError - what used to be error_temp
NNTPPermanentError - what used to be error_perm
NNTPProtocolError - what used to be error_proto
NNTPDataError - what used to be error_data
All the old names are retained for backwards compatibility; they point
to the class that replaces them. Also, any code in this module that
raises an exception, now does so with the exception class.
NNTP.__init__(): Added a new optional argument `readermode', which is
a flag that defaults to false. When set to true, the "mode reader"
command is sent to the NNTP server before user authentication. Reader
mode is sometimes necessary if you are connecting to an NNTP server on
the local machine and intend to call reader-specific comamnds, such as
`group'. If you get unexpected NNTPPermanentErrors, you might need to
set readermode. Patch provided by Thomas Wouters (who include the
standard disclaimer on is patches@python.org submission), and inspired
by Jim Tittsler.
who writes:
Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.
I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.
The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings. Hope this is
okay.
"""
The message ID is returned lowercased and there is no way to access
the original ID the server sent. Now at least some news servers
are very picky about the case of the ID and return errors when
fetching articles with mixed case given a lowercased version
of the ID.
The solution is simple: remove the string.lower() call.
"""
(I might add that the lowercasing was probably introduced as a result
of sloppy copy-and-paste coding; there's a string.lower in a similar
piece of code a bit higher in the source, that makes more sense --
it's lowercasing the group name.)