[Zope] PARENTS and the with tag
Rik Hoekstra
hoekstra@fsw.LeidenUniv.nl
Mon, 08 Nov 1999 13:12:44 +0100
> Hi,
>
> I'm having some scoping issues with PARENTS. It doesn't seem to
> acknowledge with tags or anything else. For example, if I have the
> folder hierarchy:
> A
> B
> C
> D
> E
>
> and in the index_html document of C I say:
> <dtml-with E>
> <dtml-in PARENTS>
> <dtml-var "_['sequence-item'].id"><br>
> </dtml-in>
> </dtml-with>
>
> it produces:
> C
> B
> A
That's because acquisition produces a namespace stack of A B C, so in
reversed order PARENTS are BA if index_html is a DTML Method. If index_html
is a DTML Document then PARENTS are CBA. Actually Zope should give a
NameError if you call <dtml-with E>, as E per se is not accessible from C.
If you want E, you should call <dtml-with "D.E">.
So. if you call D.E from C's index_html then its PARENTS are still C, B, and
A. The with tag does not seem to stack namespace upon the existing namespace
stack.
>
> when I actually want:
> E
> D
> A
>
> And if I say:
> <dtml-var "E.PARENTS">
>
> then I get an error message.
Yes, because PARENTS is not an attribute of E. It will generate an error
anywhere.
>
> What am I doing wrong? Is there an easy way to make it behave like I want
> it to?
This is a bit difficult to answer if you do not make clear what you want to
attain? You could change the folder hierarchy to
A
D
E
B
C
or in your own hierarchy call C's index html from E.
Rik