[Zope] dtml-with ONLY, on folders?

Dieter Maurer dieter@handshake.de
Thu, 7 Jun 2001 22:21:31 +0200 (CEST)


Brian Withun writes:
 > ...
 > FolderA
 > FolderA.dtmlmethod1
 > FolderA.FolderB
 > FolderA.FolderB.dtmlmethod2
 > ...

 > dtmlmethod2 contains:
 > <dtml-with FolderB only>
 >  <dtml-var dtmlmethod1 missing="no method1 found">
 > </dtml-with>
 > 
 > 
 > When I view dtmlmethod2, I expect to see "no method1 found", but ...
The DTML namespace and acquisition are orthogonal to one another.

"with ... only" renders its body with a new DTML namespace
that just contains "...", in your case "FolderB".

But "FolderB" acquires all attributes of its ancestors
(and maybe more from the context). They are available
in the "with" body.

A first step is to use

  "<dtml-with "FolderB.aq_explicit" only>

In most cases, this will give you what you want.
If it fails, you need an external method that uses
"aq_base" (not exposed in DTML) to check for the
existence of the attributes of "FolderB" alone.

Search the (searchable) mailing list archives, for details.


More on DTML namespace and acquisition in

  URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html



Dieter