[Zope] Problem with DTML and strings
Paul Erickson
erickson@kaivo.com
Wed, 13 Mar 2002 09:59:12 -0700
How about
<dtml-let nombre="meta_type + '_img' "> ?
string.join uses a default separator of a space, so nombre is probably
"Disk _img", note the space.
-Paul
Antonio Beamud Montero wrote:
>Hello all:
>I'm trying to construct a dynamic string to get a name of an image based
>on the meta_type of a product...
>Here is the code (it must clarify what I'm saying... :-)
>
><dtml-let nombre="_.string.join((_['meta_type'],'_img'))">
> <dtml-var nombre>
> <img src="<dtml-var "images[nombre].absolute_url()">">
><dtml-var id>
>
>But this fails miserably... Zope says KeyError, but if a use a
>expression like this:
><img src="<dtml-var "images['Disk_img'].absolute_url()">">
>
>All works fine, and is the same string that 'nombre' contains
>
>What I'm doing wrong...
>