[Twisted-Python] Components

James Y Knight foom at fuhm.net
Thu Feb 26 15:09:16 EST 2004


On Feb 26, 2004, at 2:22 PM, Christopher Armstrong wrote:
> yeeees! I really like this feature. For example, people who want to 
> override the way, say, a String input box is rendered for a formless 
> UI rendered with gtk2form (freeform, too, probably), can implement an 
> alternative IStringWidget implementor, put it in their own 
> AdapterRegistry, and stick it on the context. Then their own widget 
> will be used instead of the default, without touching anything in 
> gtk2form.

Do you like it enough to have ever used it? Because, it doesn't work 
usefully, AFAICT. You've made an entire new AdapterRegistry with 
entirely new adapterRegistry and  adapterPersistance dicts. So, you 
can't just override one adapter...Perhaps if there was an 
InheritingAdapterRegistry, or an copy method on AdapterRegistry...

But really, what's the point? You can always make a subtype of 
IStringWidget..

This page 
<http://peak.telecommunity.com/protocol_ref/protocols-context.html> 
describes how one would do context-specific protocols with PyProtocols, 
which *doesn't* seem to allow multiple registries. Basically, it seems 
to say: use a per-instance subprotocol. It may not be directly 
applicable to twisted, because of the lack of chained adaptation (A->B 
and B->C gives you A->C automatically), but it does seem to me like a 
nice way to go about it.

James





More information about the Twisted-Python mailing list