[Python-Dev] Proposed addition to ftplib (original) (raw)

Jeff Epler jepler at unpythonic.net
Tue Feb 3 20:24:58 EST 2004


Jordan, It's always good to see people contributing to Python. It's good to have you here.

I have two suggestions about your submission. Well, three. Zeroeth, take the advice of another respondant and use the Sourceforge patch submission interface.

First, when contributing patches to Python, it's most customary to use the Unix tools 'diff' and 'patch' to generate a listing of the changes you made. (If you're a Windows user, perhaps someone can be more helpful than the FAQ entry at http://www.python.org/dev/devfaq.html#how-to-make-a-patch)

Here's the patch for your change:

--- /usr/lib/python2.2/ftplib.py 2003-02-24 18:24:16.000000000 -0600 +++ ./ftplib.py 2004-02-03 19:03:07.000000000 -0600 @@ -469,6 +469,10 @@ cmd = cmd + (' ' + arg) self.retrlines(cmd, func)

Second, and this may seem foolish because of how little I know about the FTP protocol, I wonder if it makes sense to make the SITE command a method, and have chmod use it. This patch uses that idea, and makes it even easier for you to use more SITE commands easily (well, if it works):

f = ftplib.FTP(...) f.login(...) print f.site('help') 214-The following SITE commands are recognized. UMASK GROUPS IDLE CHECKMETHOD CHMOD ALIAS CHECKSUM HELP CDPATH 214 Direct comments to root at localhost. f.site('chmod', '644', '/etc/shadow') ftplib.error_perm: 550 /etc/shadow: Operation not permitted.

--- /usr/lib/python2.2/ftplib.py 2003-02-24 18:24:16.000000000 -0600 +++ ./ftplib.py 2004-02-03 19:17:37.000000000 -0600 @@ -469,6 +469,15 @@ cmd = cmd + (' ' + arg) self.retrlines(cmd, func)

Jeff



More information about the Python-Dev mailing list