[Zope3-dev] Heads Up: Problem with queryNextSiteManager
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Sep 26 03:00:26 EDT 2006
Hello everyone,
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.
- 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? 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.
Thanks for reading and any comments you might have!
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-dev
mailing list