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

Sungmook Kim dotorimook@yahoo.com
Sun, 9 Feb 2003 00:19:24 +0100 (CET)


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?
 



--- "Michael R. Bernstein" <webmaven@lvcm.com>
schrieb: > 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>
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev ) 

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Bis zu 100 MB Speicher bei http://premiummail.yahoo.de