[Zope-dev] getPhysicalPath?

Evan Simpson evan@digicool.com
Fri, 16 Mar 2001 14:27:46 -0500


From: "Christian Scholz" <cs@comlounge.net>
> And can someone explain to us where the differences between
> aq_chain and getPhysicalPath() are? Actually getPhysicalPath()
> seems also to walk up aq_parent. Or am I missing something?

"aq_chain" gives you a list of the objects traversed to get to your object,
in reverse order.

"getPhysicalPath" gives you a tuple of the Ids of all objects on the
shortest path from the root to your object.

So, given a hierarchy like this:

A__B__C
    |_D
    |_E

Object C has physical path ('', 'A', 'B', 'C') no matter how you get to it.
Its acquisition chain, on the other hand, depends completely on the path you
use to access it:

A/B/C => [C, B, A]
A/D/B/C => [C, B, D, A]
A/B/D/E/C => [C, E, D, B, A]

*WARNING*: "aq_chain" does *not* tell you the order in which acquisition
will search the objects.  That is more complicated.

Cheers,

Evan @ digicool