[Zope] How to avoid the inheritance of DTMLDocuments?

J. Cameron Cooper jccooper@rice.edu
Mon, 23 Jul 2001 13:22:45 -0500


You misunderstand the (very subtle) difference between Documents and 
Methods: methods are behaviours, and thus can't have their own data. 
They have to use the data of the object that contains them. Non-methods 
can contain their own data, since they are full objects. (DTML Methods 
may look like they contain data, but the text in the DTML body is really 
just specification for the behaviour it implements.)

 But they're all objects, and objects in Zope are acquired in the usual 
manner. Unless there happens to be a NonAcquirableObject (LocalObject 
perhaps?) out there, and I've never seen one. It might be handy to have, 
for cases like this.

>  Is there a switch to avoid the inheritance of DTMLDocuments to a 
> specific folder (i.e. in my case
>
> there's /pool/empl1, /pool/empl2 etc.) that i could set in the /pool 
> folder in my case?
>
Not really, but sort of. There's a couple ways to fight acquisition:

<dtml-with aq_explicit only>
  <dtml-var index.html>
</dtml-with>

should give you only the index.html contained in that object (if it exists.)

You can also explicitly get a parent (or child in a dtml-in loop) and 
check whether or not a property is the same with something like

<dtml-if "PARENTS[-1].thing != thing"><dtml-var thing></dtml-if>

or in a loop

<dtml-let parentproperty=property>
<dtml-in objects>
  <dtml-if "property != parentproperty">
     <dtml-var property>
  </dtml-if
</dtml-in>
</dtml-let>

but it's not pretty.

            --jcc
        (a mess, see?)