[Zope] Here's how to call a method with a known location from anywhere in the site tree.

Michael R. Bernstein webmaven@lvcm.com
08 Feb 2003 12:06:47 -0800


On Sat, 2003-02-08 at 10:42, Sungmook Kim wrote:
> Hi,
> 
> i have tried this too, but it gave me another error
> message: AttributeError
> 
> <dtml-var "PARENTS[-1].GuestBook.addEntryAction">
> 
> what am i doing wrong?

Ah. addEntryAction is a method, not a property. When calling a method in
Python (and this is a Python expression, BTW), you need to call it like
this:

<dtml-var "PARENTS[-1].GuestBook.addEntryAction()">

Depending on the method in question, you may need to supply arguments as
well:

<dtml-var "PARENTS[-1].GuestBook.addEntryAction(arg1='value1',
arg2='value2')">

I'd like to point out that it is generally a *very bad idea* to be using
DTML for application logic like this. You would be better off switching
to a combination of Python Script objects and DTML, or Python Scripts
and ZPT.

-- 
Michael R. Bernstein <webmaven@lvcm.com>