[Zope3-dev] Re: Heads Up: Problem with queryNextSiteManager

Philipp von Weitershausen philipp at weitershausen.de
Tue Sep 26 03:11:58 EDT 2006


Stephan Richter wrote:
> the following helper functions in zope.app.component do not work well with the 
> new registry concept of bases: getNextSiteManager, queryNextSiteManager, 
> getNextUtility, queryNextUtility.
> 
> Those methods expect a simple lookup tree, where the first base of a local 
> registry is the registry its parent's site manager's registry or the global 
> registry; in other words, always the first base is selected (line 45). Since 
> I started using the baseregistry, I commonly add the base registries at the 
> first position, since I want them to override the global and other parent 
> registries. Doing so breaks all components that use the above helper 
> functions. Here is the solution I am going to check in later today:
> 
> - get/queryNextSiteManager
> 
> These functions will be deprecated, since they simply make no sense with the 
> current design of the registries. I have checked the core code and they are 
> not used anywhere except for queryNextUtility. I suspect the same to be true 
> for all 3rd-party code as well, so that deprecating them should not really 
> hurt anyone.

Yes, it seems they're a relic of the old lookup tree and probalby 
should've been deprecated along with the 'next' attriubte of site managers.

> - get/queryNextUtility
> 
> They are still very useful and their extensive use in the Zope 3 core code is 
> proof of that. Luckily their fix is simple. Instead of using 
> get/queryNextSiteManager to look up the next registry, we simply iterate 
> through all the bases of the closest site manager until an answer is found. 
> This way the lookup pattern will work as before and supports the new usage 
> pattern. I have tested this fix and it works for my code well.
> 
> The really big question is:  Is that change worth porting to the Zope 3.3 
> branch?

If you're talkign about get/queryNextUtility, then yes, I think so. The 
deprecation of get/queryNextSiteManager cannot land in 3.3, of course.

> It really is a serious bug that will cause people painful error 
> messages that are hard to understand. Also, it prevents people from using 
> Zope 3.3 and z3c.baseregistry.

Well, it's not quite as black and white as that, but I can see how the 
lack of this bugfix makes it at least very hard to serve our component 
lookup registries with z3c.baseregistry.



More information about the Zope3-dev mailing list