[Zope] Product/ZClass/??? Problem

Terry Hancock hancock@anansispaceworks.com
Tue, 13 May 2003 09:43:28 -0700


On Monday 12 May 2003 07:07 pm, Simon wrote:
> I am trying to create a ToolBar widget  [....]

Frankly I didn't understand all of that, but your problem
is that your method is not being "rendered" -- i.e. "called"

It's the difference between:

my_form    <-- this is an object
my_form()  <-- this is the output from calling the object

the latter is usually the actual string sent to the browser
in Zope.

This is complicated by the fact that DTML will try
several (sensible) alternatives if "my_form" is not
a callable object, such as calling the object's __repr__
or __str__ methods, etc.

But the most import thing to know is the following:

*These* are the same for a callable object, and should
render:

<dtml-var my_form>
<dtml-var name="my_form">
<dtml-var expr="my_form(None, _)">

(note the "_").

while *these* should show the object itself (i.e. its 
__repr__ will be rendered):

<dtml-var "my_form">
<dtml-var expr="my_form">

For a *non-callable* object the above two sets are
probably equivalent, except for:

<dtml-var expr="my_form(None, _)">

which will cause a traceback (can't call a non-callable 
object!).

HTH,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com