[Zope-CMF] Re: five.localsitemanager may not do the trick
Wichert Akkerman
wichert at wiggy.net
Thu Jun 21 17:30:10 EDT 2007
Previously yuppie wrote:
> Hi!
>
>
> Wichert Akkerman wrote:
> >I spoke briefly with Balasz today and he mentioned that using
> >five.localsistemanager may not be a solution to our problem. If I
> >understand everything correctly the way KSS is setup is that it has its
> >own site manager on the view which is being called. That means that the
> >context for the site manager is the view instead of the 'normal'
> >context. So if they use five.lsm the tools will be wrapped in the view
> >instead of the correct context.
> >
> >Does anyone see a way to fix that?
>
> Is this the "Acquisition Context with Nested Sites" problem tested here?
> http://svn.zope.org/five.localsitemanager/trunk/src/five/localsitemanager/localsitemanager.txt?rev=76426&view=auto
No, it is slightly different. That test uses nested views. What KSS
does is set a site manager on a view. Something like:
class SiteViewComponents(BaseGlobalComponents):
"""Slightly different BaseGlobalComponents class"""
class SiteView(BrowserView):
next = component.getSiteManager()
self._sitemanager = SiteViewComponents('siteview')
self._sitemanager.__bases__ = (next, )
wrapped_view = self.__of__(self.context
self._sitemanager.registerHandler(wrapped_view._eventRedispatcher)
def getSiteManager(self):
return self._sitemanager
@component.adapter(IObjectEvent)
def _eventRedispatcher(self, event):
adapters = component.subscribers((event.object, self, event), None)
for adapter in adapters:
pass # getting them does the work
Interesting things happen with getUtility calls and aq wrapping in that
setup.
Wichert.
--
Wichert Akkerman <wichert at wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
More information about the Zope-CMF
mailing list