[Zope] Problem with DTML and strings

Dieter Maurer dieter@handshake.de
Wed, 13 Mar 2002 21:17:37 +0100


Antonio Beamud Montero writes:
 > Hello all:
 > <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
There probably is a small difference:

      "join" separates the components through a space.
      Therefore, you get "Disk _img" rather than "Disk_img".

      Use "_.string.join((meta_type,'_img'),'')"
      (note the extra parameter to join, specifying an empty separator).


Dieter