[Zope-dev] dtml: "where am I? who am I?"

Lalo Martins lalo@webcom.com
Wed, 24 Nov 1999 21:48:03 -0200


On Wed, Nov 24, 1999 at 04:49:30PM -0500, Michel Pelletier wrote:
> > 
> > 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.

Yes, I get that.

As I said, the real-world example is the Banner Product:

root
 +--- BroDar (Folder)
 |     +--- BotaoBroDar (BannerAd)
 +--- lalo (Folder)
       +--- aqtest (DTML Method)

Documents under ``BroDar'' can include the button by using
<dtml-var BotaoBroDar>. Works.

But if something under ``lalo'' tries to include it
(<dtml-var "BroDar.BotaoBroDar">), it will generate something
like: <a href="BotaoBroDar/hit"><img src="BotaoBroDar"></a>
which of couse won't work.

I worked around this by copying the button to my folder.

In the BannerFolder ZClass, I work around this by doing the
Python equivalent of sed'ing the BannerAd output to convert it
to something like
<a href="banner/BotaoBroDar/hit"><img src="banner/BotaoBroDar"></a>
(where ``banner'' is the name of the BannerFolder).

But I wonder if there isn't a better way.

[]s,
                                               |alo
                                               +----
--
      I am Lalo of deB-org. You will be freed.
                 Resistance is futile.

http://www.webcom.com/lalo      mailto:lalo@webcom.com
                 pgp key in the web page

Debian GNU/Linux       ---       http://www.debian.org
Brazil of Darkness   --   http://zope.gf.com.br/BroDar