Chris Withers wrote:
>
> Steve Alexander wrote:
> > That makes for a lot of security checks.
> > There are possible optimisations, though. But this starts to get even
> > more complicated.
>
> Does that mean it won't work, would be very slow, or both? ;-)
It will work. It will be slower.
I think Evan Simpson's suggestion of adding two new methods to the
acquisition wrapper is a good idea. That way, Zope remains
backward-compatible, and you get to make an explicit choice of how you
want acquisition to work, if you wish.
Perhaps there's a Collector entry on this?
---- quoted from Evan's email. Untested.
def aq_context(ob):
context = []
while ob is not None:
context.append(ob.aq_base)
ob = ob.aq_parent
ob = context.pop()
while context:
ob = context.pop().__of__(ob)
return ob
def aq_containment(ob):
context = []
while ob is not None:
context.append(ob.aq_base)
ob = ob.aq_inner.aq_parent
ob = context.pop()
while context:
ob = context.pop().__of__(ob)
return ob
----
As he pointed out, they'd make useful external methods too.
Perhaps these will find their way into Zope 2.3?
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )