On Thursday 18 October 2001 10:17 am, Michel Vayssade allegedly wrote:
Hi,
One can write :
<dtml-unless "_.has_key('lg')"> *** <dtml-var lg missing='****' > </dtml-unless>
I would like to do something like :
<dtml-unless "_.has_key('lg')"> <dtml-var "_['lg']='fr'"> </dtml-unless>
(to set-up a default value, so "lg" is always defined in the rest of the DTMLMethod )
I was believing that "_" was a python dictionnary why does it say syntax error at : <dtml-var "_['lg']='fr'">
any idea ?
Use dtml-let (scoped) or REQUEST.set (unscoped) to set variables at run-time: You do not need to use the _[...] unless you are doing an indirect lookup. This will work: <dtml-unless name="lg"> <dtml-call expr="REQUEST.set('lg','fr')"> </dtml-unless> or if lg is in REQUEST you could use: <dtml-let lg="REQUEST.get('lg','fr')"> ...Code using lg... </dtml-let> hth, /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/