[Zope] DTML Newbie: Using variable as an object in path?

Mike Renfro renfro@tntech.edu
Thu, 9 Jan 2003 15:08:25 -0600


On Thu, Jan 09, 2003 at 11:22:05AM -0500, Patrick Price wrote:

> I'm lost. I have a folder, channels, and inside that, an RDF Summary 
> object named slashdot:
> 
> <dtml-let channel="slashdot">
> <dtml-with "channels[channel]">
>   etc...
> </dtml-with>
> </dtml-let>
> 
> This results in "Global name 'slashdot' is not defined."  

Very close, try:

<dtml-let channel="'slashdot'">
  <dtml-with "channels[channel]">
    etc...
  </dtml-with>
</dtml-let>

Everything in "" is Python, and since you wanted to make a variable
equal to the string `slashdot', you have to put single quotes around
that literal string.

It's a little more obvious if you consider that <dtml-with
"channels['slashdot']"> should work just fine on its own, though it
wouldn't be a solution to your problem.

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu