[Twisted-Python] symlink support in filepath.FilePath

Ying Li cyli at alum.mit.edu
Mon Mar 24 14:48:25 MDT 2008


>So are you looking for something like this?
>
>    fp = FilePath(...)
>    fp.restat(lstat=True)
>    fp.getModificationTime() # link's modification time
>
>I'm not sure about that.  Aside from the freaky action at a distance, it
>probably is prone to failures when certain FilePath methods internally
>decide to restat, thus replacing the link data with data about the target.
>
>The cop-out API would be one like this:
>
>    fp = FilePath(...)
>    fp.lstat().st_mtime # link's modification time
>
>I can't think of anything strictly better at the moment, though.  What does
>usage in your application suggest is a good approach?

Well I had fp.restat(lstat=True) and fp.getModificationTime(lstat=True), and I'd just pass the lstat variable through.  Mostly I did this to make it compatible with the existing FilePath.  I actually only need the second approach - I sort of need to get all the attributes at once, so convenience attribute-getting methods are kind of useless for me.  So the "cop-out" API you suggest actually works better for me.




More information about the Twisted-Python mailing list