There's a RequestContainer instance at the top of the acquisition list,
as accessed through aq_parent or through aq_inner.aq_parent.

Previously, with recursive acquisition hacks, you could tell that you
were at the end of the trail because aq_parent returned None.
Unfortunately, RequestContainer doesn't seem to be acquisition-wrapped,
and doesn't support the aq_* attributes.

Here's an external method suggested by Evan Simpson in August, which
doesn't work because of having the RequestContainer at the end of the
trail.

----
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
----

What is the recommended, forwards-compatible way of knowing when to stop
recursively looking through acquisition wrappers?

--
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 )

Reply via email to