Hi Jim, On 25 March 2011 14:12, Jim Fulton <[email protected]> wrote:
>> Agree. There is a problem in that provideAdapter() and friends don't >> use getSiteManager() - the always use the global site manager. And >> there are parts of zope.component that use module level variables >> directly, ignoring hooks. > > These are meant to work this way. > > If you want to do local configuration, you should explictly select the > relevent registry/manager or call getSiteManager and use the result. I sortof understand, but it makes it impossible to let people use provideAdapter() & co in test setup and still retain some kind of layered test setup, without the kind of hacks we do in plone.testing. >>>> -- but anyone could at any time >>>> call getSiteManager.sethook to change it! >>> >>> Seriously? Nobody calls that but deep infrastructure code. >> >> People do call zope.site.hooks.setHooks() sometimes, though, e.g. upon >> traversal. > > This was never meant to be an application-level feature. I find the > notion that people would call these dureing traversal to be > disturbing. Are you sure you're not confusing this with setSite? Sorry, I meant setSite() above yes. Although sometimes people call setHooks() and then setSite(site) in test setup, because setSite() doesn't work until setHooks() has been called once. I think this may sometimes just be cargo-cult, though. Martin _______________________________________________ Zope-Dev maillist - [email protected] 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 )
