[TransWarp] PyProtocols: adapting classes to instance

Phillip J. Eby pje at telecommunity.com
Mon Sep 29 11:32:10 EDT 2003


At 11:11 AM 9/29/03 -0400, Phillip J. Eby wrote:
>class ValidatorMeta(ProviderMixin, type):
>
>     protocols.advise(instancesProvide=protocols.IOpenImplementor)
>
>     def declareClassImplements(cls,protocol,adapter,depth):
>         if adapter is protocols.NO_ADAPTER_NEEDED:
>             protocols.declareAdapter(lambda o,p: o(), protocol, 
> forObjects=[cls])

Oops.  That should be:

              protocols.declareAdapter(lambda o,p: o(), [protocol], 
forObjects=[cls])

Since it's a list of protocols that's desired.  Sorry about that.




More information about the PEAK mailing list