[Zope] Parents again

Bill Anderson bill.anderson@libc.org
Wed, 09 Feb 2000 00:01:00 -0700


Chris Withers wrote:
> 
> This is only confusing until you realise that PARENTS[whatever] returns an
> object ;-)
> 
> <dtml-var "PARENTS[-1].title">
> or
> <dtml-var "PARENTS[-1].id">
> 
> might make more sense...
> 
> Chris
> 
> Ragnar Beer wrote:
> >
> > That's what I thought how it SHOULD work, but <dtml-var
> > "PARENTS[-1]"> returns nothing and <dtml-var "PARENTS"> returns "[, ,
> > ]" the url beeing http://mydomain.de/test/parents_test/index_html no
> > matter whether I access index_html via "view" or url traversal.
> >
> > >Try looking at the PARENTS list:
> > >
> > >I'd say that you want something like <dtml-var "PARENTS[-1]"> which should
> > >give you this objects parent.
> > >
> > >Caveat:  I'm not sure if this works with DTML Methods.


Additional Caveat:
PARENTS[-1] gets you the _root_ folder, which isn't always the parent. 
In "http://mydomain.de/test/parents_test/index_html", PARENTS[-1].id
gets you whitespace (the id of the root folder), not parents_test. For
that, you want <dtml-var "PARENTS[0].id">


-- 
In flying I have learned that carelessness and overconfidence are 
usually far more dangerous than deliberately accepted risks. 
          -- Wilbur Wright in a letter to his father, September 1900