[Zope-dev] zope.component: calling an Interface and calling queryAdapter give differing results
Martin Aspeli
optilude at gmx.net
Tue Aug 19 17:23:05 EDT 2008
Shane Hathaway wrote:
> Philipp von Weitershausen wrote:
>> Shane Hathaway wrote:
>>> Looks like a bug to me. If the object passed as the first argument to
>>> queryAdapter() implements the interface passed as the second argument, I
>>> believe queryAdapter() should return the object, regardless of any
>>> component registrations.
>> No, it's not a bug. This is in fact a feature (like it or not).
>
> While I respect that this feature may have been chosen carefully, it
> nevertheless seems more like a misfeature. Chris' expectation was
> reasonable and ought not to be violated without a good cause. What code
> depends on it?
I've been bitten by this in the past as well. I can't see a good reason
why it should be that way. The only thing I can imagine needing this
would be some code that checked whether an adapter was registered, but
even then why should anyone care...
It'd be an easy thing to "fix", too.
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Zope-Dev
mailing list