[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 22:27:27 -0800


On Sat, 2003-02-08 at 15:19, Sungmook Kim wrote:
> yep, it's a method.
> but within the folder guestbook, i call this method
> as <dtml-var addEntryAction> and it works.
> whereas the addEntryAction calls
> <dtml-call expr="addEntry(arg1, arg2,...)">
> 
> i thought this should work in another folder
> X too by writing
> <dtml-var
> "PARENTS[-1].GuestBook.addEntry(arg1,arg2,...)">
> 
> should it not?

If your method does not require any arguments, you can call it like
this:

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

You can't omit the parentheses when using python expression syntax to
call a method.

Again, I would *strongly* suggest moving your application logic into
Python scripts instead. You'll find that Python is easier to learn than
you think, and the script objects will be much easier to write and
maintain than Python expressions in DTML tags.
-- 
Michael R. Bernstein <webmaven@lvcm.com>