[Zope] Newbie Q:<dtml-with> and the PARENTS tag

List Subscriptions marc-lists@powersurfr.com
Wed, 11 Jul 2001 20:02:15 -0600


Although I've searched all the How-Tos and Tips, I'm probably 
just missing something...

I have a setup as follows:

Root
      FolderA
           PropertyX
           FolderB
                  PropertyX
                  Method1
           FolderC
                   Method1

What I want to do is: for Method1, check the enclosing item for 
Property X.  PropertyX could be either a property or a DTML 
Document (I realize these may be two separate cases).  If 
PropertyX exists in/as a property of the Folderthat the Method 
is in, I want to execute some code; if it doesn't, then I don't 
want anything to happen.

Here's what I started with:

<dtml-with "PARENTS[0]" only>
     <dtml-if PropertyX>
      <dtml-var PropertyX>
      .....do some stuff...
    </dtml-if>
</dtml-with>

This doesn't work.  Using the schema outlined above, both 
FolderB/Method1 and FolderC/Method1 return a PropertyX, but in 
the latter case it's the PropertyX from FolderA (of course....).

So, does the 'only' option only restrict acquisition downward?  
Or what?  This just doesn't jibe with how the docs describe the 
only option -- maybe there's something up with my Zope?

Most importantly, how can I do what I need to do?

I've tried plugging all kinds of expressions into the with tag, 
such as aq_explicit and aq_parent, but I'm not very familiar 
with Python and am probably doing it wrong.  Really, I don't 
care how I solve this, so long as I do!  I've tried about a ton 
of things and I can't get around Zope continuing to acquire 
upward irregardless of the 'only' modifier.

When I tried it with <dtml-with PARENTS only> (no [0]), the if 
test fails in all cases.  Yet in all of these cases, <dtml-var 
"PARENTS[0].id"> returns the id of the proper folder (FolderB, 
for example), so I know that PARENTS[0] is the place I want to 
look.

Help!!!!  (c.c. me via regular e-mail as well, if possible - I'm 
on the Digest version and would love to get answer as soon as 
someone gives me one!)

Marc
marc@mail.su.ualberta.ca