[Zope-dev] getPhysicalPath?

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Mon, 19 Mar 2001 20:07:04 +1100


Brian Lloyd wrote:
> > >> Is there a simple method like getAcquistionPath() that tells
> > me how I was
> > >> required without having to do some sub optimal REQUEST
> > variable hacking /
> > >> string matching?
> > >>
> >
> > I don't know of any (but that doesn't mean there isn't one).  But
> > couldn't you walk up the aq_parent?
> 
> Acquisition tip-o-the-day: you can use:
> 
> print object.aq_chain
> 
> The aq_chain attribute (computed at time of access) provides
> a list (in reverse order) of the objects in the acquisition
> path.

   Is this *cough* documented anywhere?

   grep -r on the Zope source comes up with (not counting test_AqAlg.py):

./lib/Components/ExtensionClass/src/Acquisition.c:module_aq_chain(PyObject
*ignored, PyObject *args)
./lib/Components/ExtensionClass/src/Acquisition.c:  {"aq_chain",
(PyCFunction)module_aq_chain, METH_VARARGS, 
./lib/Components/ExtensionClass/src/Acquisition.c:   "aq_chain(ob [,
containment]) -- "

   So nobody (including the various Products I have installed) uses this
incredibly useful attribute. I have numerous places in my source where I
loop through aq_parent attributes.

   It'd be nice to have even a mention in the acquisition documentation.
Poking around the Acquisition C source tells me that there's another
attribute, aq_inner, that isn't documented either.


      Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)