dtml-with ONLY, on folders?
<DTML-WITH xxx ONLY> doesn't seem to work the way I expect, when using folders... I have: FolderA FolderA.dtmlmethod1 FolderA.FolderB FolderA.FolderB.dtmlmethod2 dtmlmethod1 contains: this is dtmlmethod1 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 instead I see "this is dtmlmethod1" It appears that the "ONLY" part of my dtml-with isn't working? Am I missing something? Brian Withun ------------
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
participants (2)
-
Brian Withun -
Dieter Maurer