[Patches] [ python-Patches-1221598 ] ftplib storbinary/storlines callback function

SourceForge.net noreply at sourceforge.net
Wed Apr 25 07:39:45 CEST 2007


Patches item #1221598, was opened at 2005-06-15 16:15
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1221598&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Phil Schwartz (phil_schwartz)
Assigned to: Nobody/Anonymous (nobody)
Summary: ftplib storbinary/storlines callback function

Initial Comment:
The ftplib.FTP class currently allows the ability to
provide a callback function for the retrbinary &
retrlines methods to invoke.  However, the
corresponding storbinary and storlines methods do not.

My ReleaseForge application currently uses the ftplib
to send files (rather than retrieve) and it's helpful
to know the percentage of the file that has been sent.
 For my app I subclassed ftplib.FTP and reimplemented
storbinary to optionally accept a callback function as
a parameter.  

However, I think this would be a useful method to
include in the standard python distribution.  I've
attached a modified version of ftplib.py which adds
this functionality.  Unlike the retrX methods, the
storX methods only invoke the callback function if it's
not None so that it will not interfere with existing
code.  For completeness, the retrX methods invoke
print_line if a callback function is not provided and
doing so for the storX functions may be undesired.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-24 22:39

Message:
Logged In: YES 
user_id=33168
Originator: NO

Terry, your comment is definitely *not* out of line!  The more people
comment on patches the easier it is for us to make a decision.  It would be
great to comment on other patches or bugs that affect you.  Thanks.

----------------------------------------------------------------------

Comment By: Terry Carroll (tcarroll)
Date: 2007-04-24 17:08

Message:
Logged In: YES 
user_id=755895
Originator: NO

I'd like to voice some support for this patch, if that's not out of line. 
I've used it myself in at least one app, and it would be nice to have it as
a standard feature in 2.6.

It seems odd that the callback feature is in the two retrieval methods,
but not the store methods.  Ruby, for example, supports it in both.  Not
that Python has to do everything Ruby does, but there doesn't seem to be
any obstacle to adding this support.

----------------------------------------------------------------------

Comment By: Phil Schwartz (phil_schwartz)
Date: 2006-07-03 11:09

Message:
Logged In: YES 
user_id=420501

Attached patch of ftplib.py (of Python 2.4.3)

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2006-03-27 23:52

Message:
Logged In: YES 
user_id=849994

Please provide your patch as a diff between the original
ftplib.py and your version. It greatly helps reviewers.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1221598&group_id=5470


More information about the Patches mailing list