[Twisted-Python] FTPResource, again

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? Anyway, I think this is enough code to make the ftp-server resourceindependent once and for all. Oh, and last there's some unused code there too, but please don't mind. \\ benjamin

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@minkirri.apana.org.au for more info, including pgp key ----------------------------------------------------------------------
participants (2)
-
abo@minkirri.apana.org.au
-
Benjamin Bruheim