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

def aq_containment(ob):
    context = []
    while ob is not None:
        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

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to