How does one refer to the root folder?
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? Andres Corrada
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]')">
<dtml-with "PARENTS[-1]"> <dtml-var rootProperty> </dtml-with> should do the trick - although you have access to rootProperty in any case because of acquisition: <dtml-var rootProperty> -- Itamar S.T. itamars@ibm.net
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
----- Original Message ----- From: "Andres Corrada-Emmanuel" <andres@mail.mamey.com> To: <zope@zope.org> Sent: Thursday, March 16, 2000 1:12 AM Subject: [Zope] How does one refer to the root folder?
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?
The root folder can indeed be accessed by PARENTS[-1]. <dtml-with "PARENTS[-1]"> is all you need. Keep in mind also that if the property of the root folder you're trying to get at has a unique name, you can get to it via acquisition. (If the property is called "foo", <dtml-var foo> would look up the property and find it, all the way at the root.) Kevin
----- Original Message ----- From: Andres Corrada-Emmanuel <andres@mail.mamey.com>
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]')">
Urk. First, we can pick this apart in at least two ways: <dtml-with "PARENTS[-1]"> or <dtml-let rootObject="PARENTS[-1]"> In either case, the part in quotes takes the last element of PARENTS, giving you the root folder. In the first case, we use this directly in a "dtml-with", and can refer to properties and contents of the root folder inside it. In the second case, we give the root folder the local name 'rootObject' which we can then use to access it. Cheers, Evan @ digicool & 4-am
participants (5)
-
Andres Corrada-Emmanuel -
Evan Simpson -
Itamar Shtull-Trauring -
Kevin Dangoor -
Lalo Martins