![](https://secure.gravatar.com/avatar/da883e723f3f11043aa4199c7f3071b1.jpg?s=120&d=mm&r=g)
On Mon, Feb 07, 2000 at 07:17:13PM +0100, Thomas Wouters wrote:
On Mon, Feb 07, 2000 at 12:53:17PM -0500, Barry A. Warsaw wrote:
I'm cutting and pasting a message that originated on the mailman-users mailing list. I think this message is fairly self-explanatory. Can other NNTP experts look this over and see if it makes sense? I'll apply it if there are no objections. Note: the bare except is bothersome.
I confess I wasn't sure if a news server that didn't recognize the 'mode reader' could be counted on to return a 500 series error. It seemed logical, but I couldn't be sure. (All of the servers I have access to accept the 'mode reader'.)
Note, though, that i've already posted a small patch to mailman to fix this. Since the 'group' command is executed by gate_news, which doesn't need authentication, it's easy enough to try the group, and set the connection to readermode if it fails.
I dislike your proposed solution for two reasons:
- It uses the nntplib's shortcmd outside of nntplib, even though it is documented as "internal".
- It doesn't work when you *do* need authentication. The group command will claim 'No such group' for groups that are hidden by authentication. (One of my mailman run on such a machine.) You need to do the 'mode reader' before authenticating. I still think it better to change nntplib.
Also note that I've already sent a patch to patches@python.org ;) with a pointer to the mailman-users discussion in question.
http://www.python.org/pipermail/patches/2000-February/000015.html
My patch uses an extra argument to NNTP.__init__, and avoids the bare except. To get the same behaviour as the patch below, sending 'mode reader' by default, the default value of readermode can be set to 1. I'm not sure if that's a wise thing, however, as some users of nntplib.NNTP might depend on the connection being able to do things that you cant do in readermode.
I sent a similar nntplib patch to mailman-users last week, although I defaulted to the current behavior and required the additional argument (or a user specified for authentication) to get the "newsreader" behavior. http://www.python.org/pipermail/mailman-users/2000-February/003935.html
Jim