Jim Fulton wrote: >>> 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. > > queryAdapter is used to look up named adapters.
It sure would be nice if it had a docstring that at least indicated that was its only intended purpose. However, how should I go about adapting an object to an interface where there may or may not be an adapter registered? The natural way would seem to be: obj = ISomething(otherobj,default=None) ...but I seem to remember people finding reasons why implementing that would never be possible. > It is also a simpler > version of queryMultiAdapter, which looks up adapters for multiple > objects. In neither of these cases does it make sense to consider the > interfaces already provided by the object being adapted. Why not? What if the name provided is None? (and why isn't the name provided None by default, rather thab being ''?) > It makes no > sense to me for queryAdapter to have different semantics depending on > whether the name argument is provided (and is non-blank). Why would the semantics be different? From a use point of view, I'd only expect queryAdapter to consider looking for a named adapter if I actually provide a name. If I provide no name, it would seem logical to look up a non-named adapter. If looking up a non-named adapter, it would make sense if the object already provides the desired interfaces to just return the object. I'd love to see where this expectation is faulty... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )