[Twisted-Python] Bloody Twisted VFS
andy at thecablelounge.com
Wed Jul 9 15:46:37 EDT 2008
On Tue, Jul 8, 2008 at 4:32 PM, <glyph at divmod.com> wrote:
> On 03:12 am, andy at thecablelounge.com wrote:
>> On Sun, Jul 6, 2008 at 3:32 AM, Jonathan Lange <jml at mumak.net> wrote:
>>> - "Decorators" like "read-only" and "chroot" could prove useful. Is
>>> there room in the design for such things?
>> Yeah, I'm all for flavouring backends with decorators.
>> That's why I keep trying to sneak this guy through ;)
> Eehhhhh... I'm glad that name starts with "_" :). It seems like one of
> those too-clever-by-half solutions to a relatively simple problem, where the
> cleverness will bite you later. Something like... I would do.
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.
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.
More information about the Twisted-Python