[Patches] [ python-Patches-462628 ] NNTPLib supports saving BODY to a file
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 28 Sep 2001 20:19:50 -0700
Patches item #462628, was opened at 2001-09-18 11:56
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=462628&group_id=5470
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Travers Naran (tnaran)
Assigned to: Nobody/Anonymous (nobody)
Summary: NNTPLib supports saving BODY to a file
Initial Comment:
I modified nntplib so the body method can accept an
optional second parameter pointing to a filehandle or
filename (string). This way, really long body
articles can be stored to disk instead of kept in
memory. The way I made the modification should make
it easy to extend this functionality to other extended
return methods.
----------------------------------------------------------------------
>Comment By: Travers Naran (tnaran)
Date: 2001-09-28 20:19
Message:
Logged In: YES
user_id=326902
I thought so too until I wrote this line in my NewsProwler
program:
response, dummy1, id, body = nntp.body(str
(article_index),tempfile.TemporaryFile())
Now true, one could use:
body = tempFile.TemporaryFile()
response, dummy1, id, dummy2 = nntp.body(str
(article_index),body)
# or don't return the 4th parameter at all
response, dummy1, id = nntp.body(str(article_index),body)
But I thought preserving the semantic meaning of the return
would be nice (the 4th parameter representing the article
body).
To be honest, I'm not wed to this convention. I'm more
than willing to change it to whatever you think is best.
I'm just happy I can contribute something! :-)
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-28 06:41
Message:
Logged In: YES
user_id=6380
Much better. Question though: what's the point of returning
the open file? Wouldn't it make more sense to return an
empty list, which the caller could ignore?
----------------------------------------------------------------------
Comment By: Travers Naran (tnaran)
Date: 2001-09-27 18:13
Message:
Logged In: YES
user_id=326902
I've made the requested changes.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-24 08:38
Message:
Logged In: YES
user_id=6380
Thanks. The patch is missing two things before it can be
accepted: change to docstrings explaining the new argument,
and changes to the documentation (Doc/lib/libnntplib.tex).
If you don't know LaTeX, just imitate what you see there and
our LaTeX expert will fix it up -- however you have to write
the documentation yourself.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=462628&group_id=5470