[Zope3-dev] Re: wildcard adapter

Philipp von Weitershausen philipp at weitershausen.de
Wed Jan 17 16:53:05 EST 2007


Chris Withers wrote:
> Hi All,
> 
> I was wondering if someone could give me a definitive explanation of 
> what the following means:
> 
> <adapter
>     for="* ISomething *"
>     ...
> 
> ...means?
> 
> Is the following equivalent:
> 
> provideAdapter(...,adapts=(None,ISomething,None),...)
> 
> ?

Yes.

> If it is, then which of the following should I use to register a generic 
> adapter for any single object to an interface:
> 
> provideAdapter(...,adapts=(None,),...)

This one.

> provideAdapter(...,adapts=None,...)

This will give you most likely an error.

> I'm not having a lot of joy registering generic adapters so I thought 
> I'd come and check my understanding here ;-)

I have no idea what a "generic" adapter is, but the zope.component API 
docs (== interfaces) are certainly complete in this sense. There are 
also doctests.


-- 
http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!



More information about the Zope3-dev mailing list