[Twisted-Python] Components

Donovan Preston dp at twistedmatrix.com
Thu Feb 26 14:28:40 MST 2004


On Feb 26, 2004, at 4:11 PM, Bob Ippolito wrote:

>
> 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 :)

And as James pointed out in another message, the context-aware registry 
currently implemented in t.p.c does not seem to do chaining, so radix' 
use case would not be implementable right now... so it would be work to 
do it the way he wants, whether it's fixing up t.p.c to do it or 
PyProtocols.

dp





More information about the Twisted-Python mailing list