[Zope] More Calling Dtml-Methods with variable names

Dieter Maurer dieter@handshake.de
Sat, 23 Jun 2001 22:34:09 +0200 (CEST)


Jeremiah White writes:
 > .....
 > But what if Method1 is not in the same folder?  For example, if it's in the folder 'Methods' which is in the folder that the main document is in.  I can't seem to get that to work.  I've tried this:
 > 
 > <dtml-var expr="_.getitem('Methods.'+someMethod,1)">
 > 
 > and I've tried changing the variable name to 'Methods.Method1', but each of these gives me an error:
 > 
 > This resource may be trying to reference a nonexistent object or variable Methods.Method1.  
 > 
 > Using Methods.Method1() does not make a difference.
 > 
 > If I just put in <dtml-var expr="Methods.Method1()">  it works.  Not what I want though.
This is an FAQ, well answered in the mailing list archives, the Zope
book and

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

Your options:
  1.
     <dtml-with "folder">
       <dtml-var expr="_.getitem(Methods,1)">
     </dtml-with>

  2. "restrictedTraverse"

 > <HTML><BODY STYLE="font:10pt verdana; border:none;">
 > ....
Please do not post HTML.



Dieter