[Twisted-Python] How to setup a ftpserver, ftpclient?

Donovan Baarda abo at minkirri.apana.org.au
Tue Apr 9 10:50:26 EDT 2002


On Wed, Apr 10, 2002 at 12:20:24AM +1000, Andrew Bennetts wrote:
> On Tue, Apr 09, 2002 at 11:05:06PM +1000, Donovan Baarda wrote:
[...]
> > I have code for this, non-twisted specific. I'm interested in supporting
> > this in conjunction with a few other useful utility modules, so any
> > changes/suggestions etc are welcome.
> 
> Certainly the writing (or "unparsing" as you call it :) part of this could
> be used.

the term "unparse" is taken strait from the Python urlparse module. I've
sorta followed the same api. I also have a "netlocparse.py" that
parses/unparses the netlock part ([user[:passwd]@]host[:port]) which the
urlparse module neglects to do anything with.

> The parsing bits also look useful, especially the date parsing.
> Unfortunately, strptime isn't portable (in particular, I don't think Windows
> has it :( ).  But you're using some module called "strptime" -- that's not
> from the standard library?

I'm using a pure-python implementation by Andy Eskilsson... I forget where I
found it. It's a bit longer than lsparse.py so I won't post it here, email
me directly if you want a copy.

> I don't think uid/gid should be numeric or translated to local names when
> parsing -- ProFTPD at least returns names, and besides remote uids may not
> match local ones.

The point of this was to return a proper stat tupple, which always uses
numeric uid/gid values. The whole local vs remote uid issue is messy... this
code will attempt the conversions with sensible fallbacks if it fails.
Generaly, the gid/uid info is useless because of the remote vs local issue
anyway, but they are included for completeness.

> Also, I'm curious as to how much more reliable this is at parsing wacky
> formats than the regular expression in
> twisted.protocols.ftp.FTPFileListingProtocol in CVS...

It's probably pretty unforgiving... it was designed exclusively to
parse/unparse ls style info.

This plus more is part of my osVFS package, which is a drop-in replacement
for for the standard os module that replaces all the file interface routines
with an Virtual File System. I already have working fake-root, mountable,
and ftp VFS backends, but I want to include a caching mixin using my
GCache.py module before I release it. I should just get off my butt and do
it...

-- 
----------------------------------------------------------------------
ABO: finger abo at minkirri.apana.org.au for more info, including pgp key
----------------------------------------------------------------------




More information about the Twisted-Python mailing list