[Twisted-Python] Bloody Twisted VFS

Andrew Bennetts andrew-twisted at puzzling.org
Wed Jul 9 19:34:56 EDT 2008

Andy Gayton wrote:
> Its a general solution for re-decorating the return result of methods
> on decorated objects, which return new instances of themselves.  Which
> is particularly handy for decorating tree node like objects, which can
> return new child instances.
> For example:
> root = FilePathNode(FilePath('/tmp'))
> root = ReadOnly(root)
> root = ForceUser(root, 'nobody')
> root.child('foo') # should return a read only node for /tmp/foo, which
> creates new files as user nobody.
> It'd be awesome to provide support for this in a simpler way.

For what it's worth, bzrlib.transport.decorator provides a similar facility
for bzrlib.transport.  It's used to implement e.g. ReadonlyTransportDecorator.
There's also a ChrootTransport, which is essentially a decorator too (although
it doesn't use bzrlib.transport.decorator because the generic decorator facility
didn't provide a sane way to track what the root of the chroot should be).

We also have lots of decorators just for testing, e.g.
FakeNFSTransportDecorator, UnlistableTransportDecorator,
FakeVFATTransportDecorator, etc.


More information about the Twisted-Python mailing list