Re: Silva2.3 / NotYet exception

Sylvain Viollon <[email protected]> Thu, 22 Sep 2011 07:37:42 +0200
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Op 21 sep 2011, om 18:02 heeft Andrew Altepeter het volgende geschreven:

   Hello,

> 
> Actually stepping through with the debugger I see it isn't a problem getting
> the filters.  The problem is when the InlineViewer uses
> 'model.restirctedTraverse(viewer_path)' to actually get the viewer (a.k.a.
> provider).  There is an acquisition 'loop' in the path, such that the aq
> chain for the news viewer contains the publication twice, see:
> 
> So the model is at /silva/cas/admissions/index
> The viewer_path is 'admissions/cas-admissions-events-viewer'
> The viewer is a /silva/cas/admissions/cas-admissions-events-viewer
> 
> The aq_chain for this provider is:
> aq_chain(provider)
> [<AgendaViewer at /silva/cas/admissions/cas-admissions-events-viewer>,
> <Publication at /silva/cas/admissions used for
> /silva/cas/admissions/visit/index>, <Page at
> /silva/cas/admissions/visit/index>, <Folder at /silva/cas/admissions/visit>,
> <Publication at /silva/cas/admissions>, <Publication at /silva/cas>, <Root
> at /silva>, <Application at >, <ZPublisher.BaseRequest.RequestContainer
> object at 0xcf9d5ec>]
> 
> The problem, I think, is the second item in the list: <Publication at X used
> for Y> (this publication appears farther down the chain as well.) Attempting
> to use aq_inner as well, i.e. aq_chain(aq_inner(provider), yields the same
> chain.
> 
> If I instead re-acquire the viewer from the root, i.e.:
> aq_chain(provider.restrictedTraverse(provider.getPhysicalPath()))
> 
> I get a clean aq_chain, and no NotYet errors.  To me, I read this a problem
> resulting from the use of restrictedTraverse (or unrestrictedTraverse for
> that matter).
> 
> I'm not sure what the best means is to adjust the code.  Ideas?

   I am not sure you can easily fix the code. For sure you cannot change the check to remove
it as, you would get different intid and don't see the references if you did.

   You can have a look at the code of five.intid, there is a loop that check the path for
any duplicate. You can remove from the path between the two duplicate, if you think that always
match your use case.

   Regards,

   Sylvain,

-- 
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands