[Zope] How does one refer to the root folder?

Lalo Martins lalo@hackandroll.org
Thu, 16 Mar 2000 10:49:32 -0300


On Thu, Mar 16, 2000 at 01:12:53AM -0500, Andres Corrada-Emmanuel wrote:
> Hi Zopistas,
> 	Does one call it "PARENTS[-1]"? I'm trying to get an attribute of the root folder and I'm failing with the syntax-
> 	<dtml-with "rootObject=_.getitem('PARENTS[-1]')">
> I now that the failure is because the object in the namespace is "PARENTS". So what is the name of the root folder?

There are three errors here :-)

First, Python atribution doesn't return the value like C. The
value of "myObject = 1" is None.

Second, as you said, 'PARENTS[-1]' is not an object. Using
_.getitem Zope will look for an object with this name, which
doesn't exist.

Third, there is absolutely no reason for the _.getitem.

What you want can be acomplished with:

<dtml-with "PARENTS[-1]">
   ...
</dtml-with>

or

<dtml-let rootObject="PARENTS[-1]">
   ...
</dtml-let>

depending on what it is you want. :-)


Also note that if you're using SiteAccess' virtual hosting,
PARENTS[-1] will (IIRC) not give you the root folder, but the
virtual root.

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://www.webcom.com/lalo           mailto:lalo@hackandroll.org
                 pgp key in the personal page

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