[Zope] dtml-with and only
   
    Michel Pelletier
     
    michel@digicool.com
       
    Wed, 03 Nov 1999 12:38:11 -0500
    
    
  
Barry A. Warsaw wrote:
> 
> 
> The problem of course is that I do not want `nickname' to be
> acquired.  I figured I could write DMTL like the following to
> accomplish this:
> 
> -------------------- snip snip --------------------
> <dtml-with folderobj only>
>    <dtml-if nickname><dtml-var nickname>
>    <dtml-else><dtml-var title_or_id>
>    </dtml-else>
> </dtml-with>
> -------------------- snip snip --------------------
The 'only' attribute does not stop acquisition, it hides all namespaces
on the Nspace stack except the object specified in the 'with'.  If that
object supports implicit acquisition (and folders do) then you can still
acquire an attribute from that object.
What you want is a combination of both 'only' and 'aq_explicit':
<dtml-with folderobj only>
  <dtml-with aq_explicit>                 <= this turns off
acquisition..
    <dtml-if nickname><dtml-var nickname>
    <dtml-else><dtml-var title_or_id>     <= this won't be acquired
either!
    </dtml-if>
  </dtml-with>
</dtml-with>
The outermost with tag may not be necesary, but it does make sure that
'nickname' is not found if it happens to be defined in a previous DTML
Nspace.
-Michel