[Zope] Mother, tell your children not to walk my way ;-) was: Running up and down the hierarchy

Danny William Adair Danny@Adair.net
Fri, 9 Mar 2001 15:23:39 +1300


Hi Bill,

You are totally right, but that only affects the top node. The deeper the
object I'm looking for is down this path, I still need the withs:

(I didn't mean Zope's root folder with 'the_root', just any node that A and
B are contained in. Was a stupid name, actually.)

mother------A-----Aa
               ---Ab------Aba------Abaa------Abaaa(image)
      ------B-----Ba
               ---Bb------Bba
                       ---Bbb(DTML document)

Every step further, one more with statement. Furthermore, if I eventually
have another "A" folder on my way up, the bus driver taking me 'with' him
will let me off too early:

mother------A-----Aa
               ---Ab------Aba------Abaa------Abaaa(image)
      ------B-----Ba
               ---A-------Bba
                       ---Bbb(DTML document)

But I've solved the issue.
I've just created a Python Script 'goto' taking one parameter 'path',
consisting of this single line:

return context.restrictedTraverse(path)

I've put it in the root folder to have it available everywhere and now can
do both of these in DTML(using the 2nd example of this mail):

<dtml-var "goto('A/B/mother/A/Ab/Aba/Abaa/Abaaa')">

<dtml-with "goto('A/B/mother/A/Ab/Aba/Abaa')">
  <dtml-var Abaaa>
</dtml-with>

I could let the path start with a '/' to start the whole marathon from
Zope's root folder, but then again I would need the permission to go
_through_ there (other with unrestrictedTraverse, I guess)

Thank you anyway,
and...thx for the membership product ;-)
Danny



>>> -----Ursprüngliche Nachricht-----
>>> Von: zope-admin@zope.org [mailto:zope-admin@zope.org]Im Auftrag von Bill
>>> Anderson
>>> Gesendet: Freitag, 9. März 2001 14:38
>>> An: zope@zope.org
>>> Betreff: Re: [Zope] Running up and down the hierarchy
>>>
>>>
>>> On 09 Mar 2001 11:27:50 +1300, Danny William Adair wrote:
>>> > Hello to everybody!
>>> >
>>> > Supposed I have an object hierarchy looking like this:
>>> >
>>> > the_root------A-----Aa
>>> >                  ---Ab(image)
>>> >         ------B-----Ba
>>> >                  ---Bb------Bba
>>> >                          ---Bbb(DTML document)
>>> >
>>> > A DTML document "Bbb" lying in folder Bb wants to access the
>>> image in Folder
>>> > Ab.
>>> > The only way I know how to do this is
>>> >
>>> > <dtml-with Bb>
>>> >   <dtml-with B>
>>> >     <dtml-with the_root>
>>> >       <dtml-with A>
>>> >         <dtml-var Ab>     (or do whatever with it)
>>> >       </dtml-with>
>>> >     </dtml-with>
>>> >   </dtml-with>
>>> > </dtml-with>
>>> >
>>> > Of course this sucks.
>>>
>>>
>>> Have you tried this? (untested):
>>> <dtml-with A>
>>>    <dtml-var  Ab>
>>> </dtml-with>
>>>
>>>
>>> Seems to me it should work. seems to me I've done this before somewhere
>>> ...
>>>
>>> But I could be wrong. :^).
>>>
>>> Bill Anderson
>>>
>>>
>>>
>>> _______________________________________________
>>> Zope maillist  -  Zope@zope.org
>>> http://lists.zope.org/mailman/listinfo/zope
>>> **   No cross posts or HTML encoding!  **
>>> (Related lists -
>>>  http://lists.zope.org/mailman/listinfo/zope-announce
>>>  http://lists.zope.org/mailman/listinfo/zope-dev )
>>>