[Twisted-Python] symlink support in filepath.FilePath

Ying Li cyli at alum.mit.edu
Mon Mar 24 14:15:46 EDT 2008


>>Should I just implement my own subclass of FilePath that handles symlinks 
>>and not try to change FilePath?
>
>It'd be great to have anything that's generally useful incorporated into
>Twisted.  It might make sense to have a FilePath subclass for a while to
>see what is an isn't useful for your SFTP server - or you might be happy
>enough to briefly have a local copy of Twisted with your modifications
>and only submit them once you're happy with them.

Well, I did write one, and that's when I was told to start submitting my changes into FilePath.  :)  Basically I need to be able to handle symlinks as links - hence the restat.

There are other things I need, such as an openWithFlags method (basically, the ISFPTServer interface specifies that I need to be able to open a file with a bunch of flags (read, write, append, create, truncate, exclusive), and I'd like to simply pass that through to a method.  I've tried to come up with a fairly elaborate mapping of said flags onto (r, w, r+, w+, etc.), but there are some things (like the exclusive flag) I don't know what to do with.

I'm not sure if this would be useful in FilePath.  

Another thing I need is to be able to change permissions.  My applications ignores requests to change ownership and such, but being able to change permissions I think would be good.  And I know that FilePath.copyTo and FilePath.moveTo right now do not preserve permissions or ownership - I'm not sure if this is desired behavior, but if it isn't, then FilePath needs some mechanism for changing the attributes of a file or directory.  But then we get into platform problems, and FilePath may get overly complicated.




More information about the Twisted-Python mailing list