Lennart Regebro wrote: >> I have very much >> come to appreciate the power of this delegation in, say, BrowserViews; >> even if it did take me several months to understand the multiadapter >> pattern! > > I hear this a lot, so this is apparently something that is common to > take a while to grasp. Any ideas of what to make multi-adapters more > understandable would probably be a good thing.
The typical misunderstanding starts like this, I think: - The developer performs some set of adapter registrations in setup. - The developer wants to do an adapter lookup at runtime. He often doesn't know which adapter he'll get back when he does a lookup, especially when he registers a number of adapter factories for less specific types than he wants to provide as "requires" lookup parameters. Multiadapters add to the mystery because the relative order of the requires arguments has an impact on which adapter is returned when there's more than one candidate adapter factory. This confusion comes about mostly because the algorithm that the registry uses to choose an adapter factory (even for single-adaptation) is not documented or specified in a consumable format anywhere. Personally, even I don't really know how it works. It would be useful if someone who did know how it worked created an analogue of this: <http://docs.repoze.org/component/basic.html#component-lookup-order-when-requires-arguments-are-specified> - C _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )