[Twisted-Python] Components

Bob Ippolito bob at redivi.com
Thu Feb 26 16:11:08 EST 2004

On Feb 26, 2004, at 3:22 PM, Christopher Armstrong wrote:

> James Y Knight wrote:
>> 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.
> Hmm... I'm reading that page, but I can't tell if it requires the 
> framework code to do special things to support context-specific 
> adapters. If it does, is there any way to implement context-specific 
> adapters that _don't_ require framework-code to know about them? i.e., 
> so plain old adaptation calls will look in the context for adapters?

I think that all of the cases where Twisted is using contextual 
adaptation are better solved by peak.binding anyway.. in the few, if 
any, cases where peak.binding is not better, then the context-specific 
adapters in the previously mentioned documentation should be enough to 
do it.

In any case, because of __conform__, __adapt__, etc. you can really do 
Whatever You Want with PyProtocols.. even if that means implementing 
the awkward to use component registry stack junk :)


More information about the Twisted-Python mailing list