[Zope] Help with DTML-var tag and Passing Variables

Casey Duncan cduncan@kaivo.com
Fri, 13 Apr 2001 08:46:14 -0600


Rob Senk wrote:
> 
> This works great as a link in a dtml method.  I pass the variable "name"
> from the page in which this link is on and I get the user's address just
> fine
> 
> <a href="<dtml-var q_address url>?Names.First_Name=<dtml-var name>">Get
> User's Address</a>
> 
> What I really want to do is not have a link and just call all the data on
> one page eliminating the need for hyperlink.  I would have thought this
> would work:
> 
> <dtml-var "q_address(Names.First_Name=<dtml-var name)>
> 
> It does not.  Just shows up as txt on the page.
> 
> If someone can help out I would appreciate it.  I have searched the archives
> extensively and tried the various methods.
> 
> Rob
> 
> 

You cannot put DTML tags inside other DTML tags. Also, your naming
convention "Names.First_Names" will cause you problems because that is
not a valid Python argument name. Periods are significant in Python as
object.attribute delimiters. Anyhow, something like this would work:

<dtml-var expr="q_address(First_Name=name)">

You can avoid having to pass this explicitly by simply setting a value
for "First_Name" somewhere in your namespace in place of "name". Then
you could just do:

<dtml-var name="q_address">

That implicitly passes all names on the namespace to your method.

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>