[Zope-dev] zope.component: calling an Interface and calling queryAdapter give differing results

Chris Withers chris at simplistix.co.uk
Fri Aug 29 05:27:35 EDT 2008


Dieter Maurer wrote:
> Jim is heavily defending this difference.
> 
> I am convinced that the difference should not be there

fork anyone? ;-)

> but meanwhile have found a use case for it.
> 
>   Suppose, you have a class "C" that implements "I".
> 
>   If "queryAdapter" would behave like "I(...)", you
>   would have no way to override the implementation
>   of "I" by "C".
> 
>   With the current behavior, you can use
>   "queryAdapter(c, I)" to check whether some special
>   requirements apply and in this case use the special purpose
>   adapter.

Right, so every time you want these semantics you have to jump through 
these hoops. My understanding of the CA was that it was supposed to stop 
the need for this kind of copy'n'paste coding?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list