[Twisted-Python] FTPResource, again

Donovan Baarda abo at minkirri.apana.org.au
Tue Jun 4 13:43:00 EDT 2002


On Tue, Jun 04, 2002 at 03:43:01PM +0200, Benjamin Bruheim wrote:
> Hey,
> 
> Here are a draft for "Resources". This one follows Itamars suggestion (which I after some dispute with myself found necessary).
> The path-stuff is awful, so ignore it. A combination of the module posixpath (undocumented) and os.path is a good replacement. Otherwise, there's some random routines, and the Interfaces aren't specified. Any ideas what must in and what must go? Request.render is silly :)
> This is just a "proof of concept", but I fear I've done some fundemental errors. Especially the "resolving" of objects is idiotic and naive. Any suggestions for replacements?

Maybe not related, but maybe it has something useful for you.

My osVFS stuff is 95% complete. It's a drop in replacement for os that
allows you to virtualise the underlying filesystem. Two basic VFS's are
fakeroot_filesystem and mountable_filesystem, though I also have an ftp
backend working too. These let you do things like the following;

import osVFS

f1=osVFS.fakeroot_filesystem(os,'/var')
f2=osVFS.fakeroot_filesystem(os,'/tmp')
os=osVFS.mountable_filesystem() #sets os to virtual filesystem os
open=os.file                    #sets open to file method of os
os.mount(f1,'/')
os.mount(f2,'/local')
print os.listdir('/') # will print list of files in /var
os.chdir('/local')
print os.listdir('.') # will print list of files in /tmp
f=open('/local/temp.txt','w') # will return open file /tmp/temp.txt


The last 5% left is finalising a caching mixin that does agressive caching
with smart expiry based on squid-type expiry methods.

I realise that twisted serves up "resources", but if you have a
posix-to-resource implementation, this would allow you to sit that ontop of
other VFS backends... ie with the ftpVFS backend you would be able to do an
ftp proxy. 


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




More information about the Twisted-Python mailing list