[Twisted-Python] twisted.vfs issues

Andy Gayton andy at thecablelounge.com
Thu Sep 29 08:43:04 EDT 2005


Jp Calderone wrote:
> On Thu, 29 Sep 2005 05:49:04 +1000, Andy Gayton 
> <andy at thecablelounge.com> wrote:
> 
>> James Y Knight wrote:

>  I assume you mean that they should always return a Deferred.  In this 
> case, I agree.  maybeDeferred is intended as a convenience for 
> application-level code.  Framework-level code can avoid introducing the 
> need for it at the application-level by simply always using Deferreds.

ok, http://twistedmatrix.com/bugs/issue1223

> The semantics provided by vfs should be the same across all platforms 
> and all backends.  Since os.rename's semantics vary between platforms, 
> this probably eliminates it from (unaided) use in an implementation.  
> .rename() in VFS should work across filesystems, guarantee atomicity (if 
> this is feasible - I think it is.  If not, it should explicitly deny 
> atomicity), and have well-defined edge cases (for example, whether an 
> exception is raised because the destination exists already should be 
> defined one way or the other, and that's how it should always work).

all that stuff on rename sounds great (moving between filesystems etc) 
.. might as well aim for it until its not possible.

http://twistedmatrix.com/bugs/issue1224

>>> 5) Errors are coarse-grained. Everything is a VFSError, and the only 
>>> detailed information is in human-readable text, not any nice 
>>> computer- readable form.

http://twistedmatrix.com/bugs/issue1225

> Going further, I'd like to see pathutils implemented in terms of 
> twisted.python.filepath: there's a lot of code duplication between these 
> two modules.

yep, http://twistedmatrix.com/bugs/issue1226

> As I mentioned above, twisted/vfs/adapters/ftp.py and stream.py 
> shouldn't be importing from twisted.web2.  Likewise, 
> twisted/vfs/adapters/sftp.py's dependence on twisted.conch is backwards: 
> twisted.conch should provide code which augments twisted.vfs.  These are 
> both great candidates for use of the plugin system.  This also lets you 
> take care of the nasty registration-requires-import issues, since 
> gathering plugins will necessarily import the required modules, or if 
> not, will provide a hook so that they can be imported at precisely the 
> right time.

ok - will check out the plugins stuff.  just haven't come across it yet.

> Some easy things: new code in Twisted should use new-style classes; 
> modules should have `test-case-name' declarations; zope Interface's 
> convention is to not include "self" in method declarations; "type(x) is 
> y" is generally wrong - osfs.py uses it in getMode() - both because 
> isinstance() should really be used, and because type checking generally 
> indicates some weakness in an API (why might the mode be either a string 
> or an integer?  pick one and require only that).

http://twistedmatrix.com/bugs/issue1227

> I hope this doesn't come off as too critical :)  I'm very much looking 
> forward to the day when setting up a dav server against a purely 
> virtual, dynamic filesystem is as easy as implementing a couple 
> interfaces out of ivfs.py.

Not at all.  The feedback is appreciated.

Andy.




More information about the Twisted-Python mailing list