[Zope3-Users] Re: Re: Checking if an interface is provided by an object or could be adapted to

Martin Aspeli optilude at gmx.net
Sun Apr 30 20:17:27 EDT 2006


On Mon, 01 May 2006 00:55:46 +0100, Stephan Richter  
<srichter at cosmos.phy.tufts.edu> wrote:

> On Sunday 30 April 2006 19:34, Bernd Dorn wrote:
>> component.queryMultiAdapter((bar,baz), IFoo) is not None or False
>
> Why not just:
>
> component.queryMultiAdapter((bar,baz), IFoo, default=False)

Well, it seems that if I have:

>>> class Foo(object):
     .    implements(IFoo)

>>> context = Foo()
>>> component.queryAdapter(foo, IFoo, default=None)
None

I assume it's the same with single adapters? As I said, I may well be  
doing something wrong, but that's what was happening to me (using Five,  
Zope 2.9.2). If it makes any difference, the interface in question (IFoo)  
was applied to the class Foo using <implements> in ZCML (legacy/backwards  
compatability issue).

Martin

-- 
"You can just adapt yourself out of it..." // Archipelago sprint 26/04/2006



More information about the Zope3-users mailing list