[Zope] Interrogating DTML values from within an External method

Nick Garcia ngarcia@codeit.com
Thu, 29 Jul 1999 09:00:10 -0700


At 01:08 PM 7/29/99 +0100, Tony McDonald wrote:
>I've spent all morning on this and searched the Zope and ZDP site to no avail.
>
>How do I get values of dtml variables defined in a DTML document from 
>within an external method?

Well, noone else seems to have answered this one, so I think I'll take a
stab at this.  Note that I
haven't done much programming in Zope2, so this all applies to Zope 1.10.x,
although I don't think it should make a difference.

Anyway, the way I've always done it is to explicitly name the variables and
not bother trying to use the REQUEST.  So, my function would look like this:

def ExternalMethod(self, var1, var2):

and my dtml call to it would be:
<!--#var "ExternalMethod(var1=var1, var2=var2)"-->

Then thing about the self variable that gets passed in (I think) is it
passes in a reference to the folder, not the dtml document.  At least I use
it to call other methods using self.somemethod.

Hope this helps a bit.


Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com