[Zope] Passing arguments to DTMLMethods

James W. Howe jwh@allencreek.com
Thu, 09 Mar 2000 10:48:08 -0500


I know that there have been several threads on this list concerning the way 
to pass arguments to a DTMLMethod.  I've done what I think is correct, yet 
my result is less than pleasing.

Here's what I have and what I'm doing.  Hopefully someone will identify 
what I'm doing wrong.

In my web sites root folder (aka /Foo), I have a DTMLMethod named 
"siteRoot".  It simply answers "Foo".

In a subfolder of Foo, I have a method named "linkFor".  The code for this 
method looks like this:

/<dtml-var siteRoot>/SomePage?option=<dtml-var optionValue>

In the same folder that contains the "linkFor" method, I have another 
method which wants to use the result of the "linkFor" method.  In this 
method there is a line which looks like this:

<a href="<dtml-var "linkFor(_, _.None, optionValue='some value')">">Some 
Text</a>

When this code gets executed, I get a "KeyError" on "siteRoot".  For some 
reason, when my linkFor method executes, it can't see the siteRoot method, 
even though the method exists in the parent folder.  What am I doing 
wrong?  Why can't linkFor see siteRoot?

Thanks.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103