From: "Randall F. Kern" <randy@spoke.net>
def __of__(self, parent): if not hasattr(self, 'aq_parent'): return ImplicitAcquisitionWrapper(self, parent) else: category = parent.unrestrictedTraverse(self._category._path) return ImplicitAcquisitionWrapper(self, category.__of__(parent))
This is genuine deep-down hard stuff. It's not too hard to make an acquisition wrapper, as you're doing, but there are subtle implications in the way it's constructed. Many parts of Zope assume that an object's wrapper was produced normally, and that therefore you can follow the containment chain by repeatedly taking the aq_inner.aq_parent. Your inserted object therefore ends up hijacking containment (with security effects) or worse, cutting containment short. I *think* that you might get something resembling the effect you're looking for with this: def __of__(self, parent): if not hasattr(self, 'aq_parent'): parent = parent.unrestrictedTraverse(self._category._path) return ImplicitAcquisitionWrapper(self, parent) Cheers, Evan @ digicool & 4-am