[Python-checkins] python/dist/src/Lib nntplib.py,1.32,1.33

esr@users.sourceforge.net esr@users.sourceforge.net
Sun, 17 Nov 2002 09:53:15 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11255

Modified Files:
	nntplib.py 
Log Message:
Guard against error if .netrc is missing.


Index: nntplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** nntplib.py	14 Nov 2002 02:19:44 -0000	1.32
--- nntplib.py	17 Nov 2002 17:53:12 -0000	1.33
***************
*** 136,146 ****
          # If no login/password was specified, try to get them from ~/.netrc
          # Presume that if .netc has an entry, NNRP authentication is required.
!         if not user:
!             import netrc
!             credentials = netrc.netrc()
!             auth = credentials.authenticators(host)
!             if auth:
!                 user = auth[0]
!                 password = auth[2]
          # Perform NNRP authentication if needed.
          if user:
--- 136,149 ----
          # If no login/password was specified, try to get them from ~/.netrc
          # Presume that if .netc has an entry, NNRP authentication is required.
!         try:
!             if not user:
!                 import netrc
!                 credentials = netrc.netrc()
!                 auth = credentials.authenticators(host)
!                 if auth:
!                     user = auth[0]
!                     password = auth[2]
!         except IOError:
!             pass
          # Perform NNRP authentication if needed.
          if user: