[Zope] Re: Methods in a Simple Class

Alexandre Ratti alex@gabuzomeu.net
Tue, 14 Mar 2000 21:18:30 +0100


Hi Olivier,


This sounds like a namespace issue.

When using the Python quoted syntax I think you need to enclose the namespace:

Could you try this:

<dtml-var "myClass.render_1(_.None, _)">


Here are explainations straight from my Zope snippets:

 > When you call a DTML method in an expression from DTML, you must pass
 > "_.None,_" as the first two parameters if you want the current namespace
 > to pass through.  Otherwise, [the DTML method you are calling] will
 > not have access to any variables [or methods] other than 'title' and
 > 'body', period.

Note you could also pass additional variables:

 > To pass variables to another DTML Method,
 >
 > <dtml-call "mymethod(_.None, _, var1=5, var2='hello')">
 >
 > The first two parameters pass along the namespace. After that, you can set
 > other variables that are needed by the method.


Glop ?

Alexandre


At 15:24 14/03/2000 +0100, Olivier Deckmyn wrote:
(...)

>I have two (or more) rendering methods ...
>Sometimes I call one or another, depending on the page I want to render it
>in...
>
>I wanted to write :
><dtml-var myClass.render_1>
>or <dtml-var "myClass.render_1()">
>
>
>but never works :(
>The only thing I've found to be working is :
><dtml-with myClass>
>   <dtml-var render_1>
></dtml-with>
>
>pas glop...
>
>(...)