[Zope] The old dmtl namespace question

David McCuskey david.mccuskey@bigfoot.com
Tue, 5 Jun 2001 20:16:56 -0700


On 6/6/01, Tom enlightened me with:

>I am sorry to ask the same question again, but I am still completely stumped
>after many hours of trying and reading.
>
>I have:-
>
>Folder1
>  - method1
>Folder2
>  - method2  <- this method calls method3
>  - method3
>
>When I call an object like this...
>>From  method1
><dtml-call "REQUEST.set('variable','value')">  <- I want to set some
>variables too
><dtml-var "folder2.method2">
>
>The method works perfectly, except that it does not render.
>
>When I call it like this....
>>From method1
><dtml-call "REQUEST.set('variable','value')">
><dtml-var "folder2.method2()">
>
>It seems to have no namespace at all and causes an error (method2 is calling
>method3 and cant find it.)
>


here are different ways to call methods:
1. <dtml-var method>
2. <dtml-var "method( _.None, _ )">
3. <dtml-var "method()">
4. <dtml-var "method">


1 and 2 are the same: if you don't put quotes or parens, zope will pass
_.None and _ for you. 99.99999% of the time you want to use these.

3 is calling the method, but drops the namespace stuff because the
namespace variables are not explicitly included in the args. the
parameter list is empty.

4 is well, number 4. watch out for number 4. like you said, it calls, but
doesn't render.




>I have found a few similar posts to the mailing lists and most responses
>point to..
>http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
>which I have read over and over and still dont understand.
>
>It mentions _.None, and _ but I cant work out how they work.
>
>Basically I want method2 to have access to all the methods in folder2 as
>well as all REQUEST variables.
>
>Can someone please show some examples of how to do this.

do this:
 
<dtml-var "your_method( _.None, _, param='value', param2='value2' )">


my previous reply to "passing parameters to DTML methods" has some
discussions and a pointer in the ZDP which i thought were good.

check this from dieter:

     <dtml-let param1="value1"
               param2="value2"
	       ....>
       <dtml-XXX method>
     </dtml-let>

david

-- 
David McCuskey
david.mccuskey@bigfoot.com