[Zope] RE: RE: Q: How can i check the existence of an image?

Dirk Datzert Dirk.Datzert@rasselstein-hoesch.de
Sat, 05 Jan 2002 22:52:55 +0100


>
> My Code:
>       <dtml-let myTemp=id>
>       <dtml-let MyID="'theme_'+myTemp+'.gif'">
> 'if an image is not available, this will result in an KeyError
>         <dtml-if "images[MyID]">

try <dtml-if "hasattr(images, MyID)"> instead

I must correct this a little bit:

<dtml-if "_.hasattr(images,MyID) ">

>
>                 <dtml-var "images[MyID]">
>         <dtml-else>
>                 <dtml-var "images['theme_']">
>         </dtml-if>
>       </dtml-let>
>       </dtml-let>
>