nntplib.py 'mode reader' addition 
Author Message
 nntplib.py 'mode reader' addition

I propose the addition of an NNTP 'mode reader' command to nntplib.py
NNTP.__init__, *before* sending the authinfo.  This would allow nntplib to
work in cases where the connecting system might be an NNTP peer of the
server. If already in NNRP reader mode, the 'mode reader' command is a noop,
returning the original welcome string again.

(Or, the 'mode reader' command may not be implemented on the server, so I've
wrapped it in try: except: and simply ignore the failure in that case.)

diff -u nntplib.py.dist nntplib.py
--- nntplib.py.dist     Tue Apr 28 17:43:35 1998

                self.file = self.sock.makefile('rb')
                self.debugging = 0
                self.welcome = self.getresp()
+               try:
+                   self.welcome = self.shortcmd('mode reader')
+               except:
+                   pass
                if user:
                    resp = self.shortcmd('authinfo user '+user)
                    if resp[:3] == '381':

--

http://www.*-*-*.com/



Mon, 11 Dec 2000 03:00:00 GMT  
 nntplib.py 'mode reader' addition


Quote:
> I propose the addition of an NNTP 'mode reader' command to nntplib.py
> NNTP.__init__, *before* sending the authinfo.  This would allow nntplib to
> work in cases where the connecting system might be an NNTP peer of the
> server. If already in NNRP reader mode, the 'mode reader' command is a noop,
> returning the original welcome string again.

> (Or, the 'mode reader' command may not be implemented on the server, so I've
> wrapped it in try: except: and simply ignore the failure in that case.)

> diff -u nntplib.py.dist nntplib.py
> --- nntplib.py.dist     Tue Apr 28 17:43:35 1998
> +++ nntplib.py  Tue Jun 23 22:06:00 1998

>                 self.file = self.sock.makefile('rb')
>            self.debugging = 0
>            self.welcome = self.getresp()
> +               try:
> +                   self.welcome = self.shortcmd('mode reader')
> +               except:
> +                   pass
>                 if user:
>                     resp = self.shortcmd('authinfo user '+user)
>                if resp[:3] == '381':

You don't need to modify nntplib to get this effect -- simply call the
constructor without a user, and call the commands to set 'mode reader'
and 'authinfo ...' after the constructor.

Your reference to mode reader perhaps not being implemented makes me
worry that adding this might break existing code (even though you
catch the error), so I'm reluctant to add it to the constructor by
default.

--Guido van Rossum (home page: http://www.python.org/~guido/)



Mon, 11 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. execfile('bla.py'), can bla.py know its full path

2. language addition: automatic 'new'

3. language addition: automatic 'new'

4. TIP #53: Addition of 'assert' Command

5. Digipaint 3's 'rendering mode'

6. os.listdir('*.py')

7. Bug in nntplib.py

8. nntplib.py converts message ID to lowercase

9. Icons missing in 'Local' mode

10. Blinker 'DUAL' Mode

11. Read in 'raw'-mode

12. ruby-mode and '+'

 

 
Powered by phpBB® Forum Software