[Zope] Containment or context

Evan Simpson evan@digicool.com
Thu, 15 Jun 2000 18:20:52 -0400


I have paraphrased your example at
http://www.zope.org/Wikis/zope-dev/AcquisitionFeedback

We are considering providing some way for you to acquire properties in the
way you expected.  You can read more about this in the pages connected to
the AcquisitionFeedback page.

----- Original Message -----
From: Stephen Harrison <stephen@nipltd.com>
[snip]
> http://www.zope.org/Members/Hoekstra/ChangingContexts1
>
> it states that PARENTS is defined as the acquisition parents of an
> object.  But this is not true.

PARENTS is the list of objects traversed to get to the *published* object.
If you visit "/foo/bar/foo/bar/baz", then PARENTS will contain [bar, foo,
bar, foo, /].  If baz calls another method, PARENTS is unaffected, as are
the URLn and BASEn variables.  Only absolute_url() is affected.

The only way (right now) to search for a property in the order PARENTS
mentions them is to do so explicitly, by looping through the elements of
PARENTS and checking their 'aq_explicit' for the property.  Example Python
snippet:

for p in REQUEST['PARENTS']:
    if hasattr(p.aq_explicit, propname):
        return getattr(p, propname)
raise AttributeError, propname

Cheers,

Evan @ digicool & 4-am