[Python-checkins] python/dist/src/Lib nntplib.py,1.35,1.36

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Sat, 19 Apr 2003 11:05:00 -0700


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

Modified Files:
	nntplib.py 
Log Message:
- Several methods of nntplib.NNTP have grown an optional file argument
  which specifies a file where to divert the command's output
  (already supported by the body() method).  (SF patch #720468)
  Thanks to Terry Carroll.


Index: nntplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** nntplib.py	27 Feb 2003 20:14:36 -0000	1.35
--- nntplib.py	19 Apr 2003 18:04:57 -0000	1.36
***************
*** 265,269 ****
          return self.getlongresp(file)
  
!     def newgroups(self, date, time):
          """Process a NEWGROUPS command.  Arguments:
          - date: string 'yymmdd' indicating the date
--- 265,269 ----
          return self.getlongresp(file)
  
!     def newgroups(self, date, time, file=None):
          """Process a NEWGROUPS command.  Arguments:
          - date: string 'yymmdd' indicating the date
***************
*** 273,279 ****
          - list: list of newsgroup names"""
  
!         return self.longcmd('NEWGROUPS ' + date + ' ' + time)
  
!     def newnews(self, group, date, time):
          """Process a NEWNEWS command.  Arguments:
          - group: group name or '*'
--- 273,279 ----
          - list: list of newsgroup names"""
  
!         return self.longcmd('NEWGROUPS ' + date + ' ' + time, file)
  
!     def newnews(self, group, date, time, file=None):
          """Process a NEWNEWS command.  Arguments:
          - group: group name or '*'
***************
*** 285,296 ****
  
          cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time
!         return self.longcmd(cmd)
  
!     def list(self):
          """Process a LIST command.  Return:
          - resp: server response if successful
          - list: list of (group, last, first, flag) (strings)"""
  
!         resp, list = self.longcmd('LIST')
          for i in range(len(list)):
              # Parse lines into "group last first flag"
--- 285,296 ----
  
          cmd = 'NEWNEWS ' + group + ' ' + date + ' ' + time
!         return self.longcmd(cmd, file)
  
!     def list(self, file=None):
          """Process a LIST command.  Return:
          - resp: server response if successful
          - list: list of (group, last, first, flag) (strings)"""
  
!         resp, list = self.longcmd('LIST', file)
          for i in range(len(list)):
              # Parse lines into "group last first flag"
***************
*** 324,333 ****
          return resp, count, first, last, name
  
!     def help(self):
          """Process a HELP command.  Returns:
          - resp: server response if successful
          - list: list of strings"""
  
!         return self.longcmd('HELP')
  
      def statparse(self, resp):
--- 324,333 ----
          return resp, count, first, last, name
  
!     def help(self, file=None):
          """Process a HELP command.  Returns:
          - resp: server response if successful
          - list: list of strings"""
  
!         return self.longcmd('HELP',file)
  
      def statparse(self, resp):
***************
*** 415,419 ****
          return self.shortcmd('SLAVE')
  
!     def xhdr(self, hdr, str):
          """Process an XHDR command (optional server extension).  Arguments:
          - hdr: the header type (e.g. 'subject')
--- 415,419 ----
          return self.shortcmd('SLAVE')
  
!     def xhdr(self, hdr, str, file=None):
          """Process an XHDR command (optional server extension).  Arguments:
          - hdr: the header type (e.g. 'subject')
***************
*** 424,428 ****
  
          pat = re.compile('^([0-9]+) ?(.*)\n?')
!         resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str)
          for i in range(len(lines)):
              line = lines[i]
--- 424,428 ----
  
          pat = re.compile('^([0-9]+) ?(.*)\n?')
!         resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str, file)
          for i in range(len(lines)):
              line = lines[i]
***************
*** 432,436 ****
          return resp, lines
  
!     def xover(self,start,end):
          """Process an XOVER command (optional server extension) Arguments:
          - start: start of range
--- 432,436 ----
          return resp, lines
  
!     def xover(self, start, end, file=None):
          """Process an XOVER command (optional server extension) Arguments:
          - start: start of range
***************
*** 441,445 ****
                           id, references, size, lines)"""
  
!         resp, lines = self.longcmd('XOVER ' + start + '-' + end)
          xover_lines = []
          for line in lines:
--- 441,445 ----
                           id, references, size, lines)"""
  
!         resp, lines = self.longcmd('XOVER ' + start + '-' + end, file)
          xover_lines = []
          for line in lines:
***************
*** 458,462 ****
          return resp,xover_lines
  
!     def xgtitle(self, group):
          """Process an XGTITLE command (optional server extension) Arguments:
          - group: group name wildcard (i.e. news.*)
--- 458,462 ----
          return resp,xover_lines
  
!     def xgtitle(self, group, file=None):
          """Process an XGTITLE command (optional server extension) Arguments:
          - group: group name wildcard (i.e. news.*)
***************
*** 466,470 ****
  
          line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$")
!         resp, raw_lines = self.longcmd('XGTITLE ' + group)
          lines = []
          for raw_line in raw_lines:
--- 466,470 ----
  
          line_pat = re.compile("^([^ \t]+)[ \t]+(.*)$")
!         resp, raw_lines = self.longcmd('XGTITLE ' + group, file)
          lines = []
          for raw_line in raw_lines: