-----Original Message----- From: Lalo Martins [mailto:lalo@webcom.com] Sent: Wednesday, November 24, 1999 3:41 PM To: zope-dev@zope.org Subject: [Zope-dev] dtml: "where am I? who am I?"
Is there a way for a method (dtml or python, whatever) to know its location? Say:
foo (folder) +--- bar (folder) | +--- my_method (DTML|python method) +--- gee (folder) +--- index_html
if gee/index_html calls my_method, it doesn't know it's inside ``bar'' so it messes up any relative URL it spits.
I think what your looking for is the containment path of the object, not the acquisition path. If you use acquisition, you'll have to deal with the fact that the objects 'path' depends on how it is acquired. In your example, if gee/index_html called my_method, then its aq_parent is 'gee' not 'bar'. This is the correct behavior. If you want to find an objects *containment* parent, then you have to do 'object.aq_inner.aq_parent'. You cannot get 'aq_inner' from DTML, I can't think of any good reason why not, but security would have to be carefully thought out. -Michel