[Zope3-dev] Re: wildcard adapter

2007-01-19 Thread Chris Withers
Tres Seaver wrote: >>> provideAdapter(adapter,adapts=(None,None),provides=ITest) >>> getMultiAdapter((1,1),ITest) Traceback (most recent call last): ... zope.component.interfaces.ComponentLookupError: ((1, 1), , u'') Oh dear, what have I done wrong here? The "order" of your adapter registr

[Zope3-dev] Re: wildcard adapter

2007-01-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Withers wrote: > Marius Gedminas wrote: >> Now when you try to adapt anything to ITest, zope.component will call >> your ``adapter`` function and then check the return value. A return >> value of None means "the adapter is not available", and re

[Zope3-dev] Re: wildcard adapter

2007-01-19 Thread Martijn Faassen
Marius Gedminas wrote: On Thu, Jan 18, 2007 at 08:55:17AM +, Chris Withers wrote: Marius Gedminas wrote: BTW passing interfaces to provideAdapter/ is out of fashion. This stuff is getting almost perl-ish in it's "there's many ways to do it, pick the style you like" nature.. There's a sli

Re: [Zope3-dev] Re: wildcard adapter

2007-01-19 Thread Chris Withers
Marius Gedminas wrote: Now when you try to adapt anything to ITest, zope.component will call your ``adapter`` function and then check the return value. A return value of None means "the adapter is not available", and results in a TypeError you see here: Yes, apologies, both you and Philipp are

Re: [Zope3-dev] Re: wildcard adapter

2007-01-18 Thread Philipp von Weitershausen
On 18 Jan 2007, at 09:53 , Chris Withers wrote: Philipp von Weitershausen wrote: 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. Given that you can register adapters for

Re: [Zope3-dev] Re: wildcard adapter

2007-01-18 Thread Marius Gedminas
On Thu, Jan 18, 2007 at 08:53:36AM +, Chris Withers wrote: > Philipp von Weitershausen wrote: > >>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. > > Gi

Re: [Zope3-dev] Re: wildcard adapter

2007-01-18 Thread Chris Withers
Philipp von Weitershausen wrote: 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. Given that you can register adapters for any class, whether or not it implements any int

[Zope3-dev] Re: wildcard adapter

2007-01-17 Thread Philipp von Weitershausen
Martin Aspeli wrote: Chris Withers wrote: Hi All, I was wondering if someone could give me a definitive explanation of what the following means: No, but this is: provideAdapter(...,adapts=(Interface, ISomething, Interface),...) Actually, ZCML translates a "*" to None. And as of Zope 3

[Zope3-dev] Re: wildcard adapter

2007-01-17 Thread Philipp von Weitershausen
Chris Withers wrote: Hi All, I was wondering if someone could give me a definitive explanation of what the following means: 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,),...)