nntplib, huge xover object

carroll at tjc.com carroll at tjc.com
Fri Apr 4 22:31:06 EST 2003


On Fri, 04 Apr 2003 15:00:28 -0800, carroll at tjc.com wrote:

>On 3 Apr 2003 16:51:25 GMT, Ben Hutchings
><do-not-spam-ben.hutchings at businesswebsoftware.com> wrote:
>
>>Or you can edit nntplib to add the option of storing XOVER output to a
>>file.  It doesn't look like this would be too hard.  The 'file' could
>>be an object that processes each line as it comes, rather than a real
>>file.  Then send your change to nntplib back to the author and hope it's
>>accepted into the official version.
>
>That's not a bad idea.  David, you should consider taking this
>approach.

David --

I've made an minor modification to nntplib to do this.  So far, I've
modified only the xover method, but I intend to change all the
commands that return lists, and submit it as a proposed change.  Let
me know if you'd like a copy.

Original method works as follows:

   xover(start, end)
       Return a pair (resp, list). list is a list of tuples, one for
       each article in the range delimited by the start and end
       article numbers. Each tuple is of the form (article number,
       subject, poster, date, id, references, size, lines). This is an
       optional NNTP extension, and may not be supported by all
       servers.

Modified method works as follows:

   xover(start, end, [file])
       Return a pair (resp, list). list is a list of tuples, one for
       each article in the range delimited by the start and end
       article numbers. Each tuple is of the form (article number,
       subject, poster, date, id, references, size, lines).  

       If the file parameter is specified, then the output is stored
       to a file rather than to list.  If file is a string, then the
       method will open a file object with that name, write to it, 
       then close it.  If file is a file object, then it will start
       calling write() on it to store the lines returned by XOVER.  If
       file is supplied, then the returned list is an empty list.
  
       This is an optional NNTP extension, and may not be supported
       by all servers.

   




More information about the Python-list mailing list