[Twisted-Python] config interface

Chris Armstrong carmstro at dynup.net
Sun Apr 8 21:04:02 EDT 2001

I've been working a whole lot on the config interface, and I don't like 
how things are working right now. 

configurable objects are organized in a tree. Every object defines these

    #ContainableTypes should return a list of classes that
    #it can hold.
    def configContainableTypes(self): pass

    #Type should return the type of the current object
    def configType(self): pass
    #GetContents should return a dict of children of this object. {"name": obj}
    def configGetChildren(self): pass

    #AddItem should add a child to this object
    def configAddItem(self, id, item): pass

    #RemoveItem should remove a child from this object.
    def configRemoveItem(self, id): pass

I'd like to change this API somewhat to allow different paramaters to add and 
remove item methods. Not all objects need ids to add an object, and it's not
natural for some objects to represent their contents as a dict (selectors,
for instance). I was thinking about a solution similar to the improper-state
trick that glyph described to me, only it would just look at the arguments
that a method needs rather than a constructor of a class.

So, maybe there could be standardized names for paramaters of AddItem or
RemoveItem so that a front-end would know what exactly to get from the user
to add or remove an item. GetChildren could also just return either a list
or a dict, and the front-end would handle it appropriately.

This is not a developed idea at all, and I just wanna run it by anyone who
cares. Standardizing names of paramaters doesn't seem very clean to me, but
I can't think of much else..
Chris Armstrong   http://twistedmatrix.com/~carmstro     carmstro at dynup.net
There is a 90% chance that this message was written when the author's been
awake longer than he should have. Please disregard any senseless drivel.

More information about the Twisted-Python mailing list