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 ? -- _/ _/ _/_/_/ _/_/ Michel.Vayssade@UTC.fr Service Informatique _/ _/ _/ _/ T:33/0-3.44.23.49.24 Universite de Technologie _/ _/ _/ _/ F:33/0-3.44.23.46.77 BP 20.529 60205 Compiegne _/_/ _/ _/_/ _ mv@utc.fr __/www.utc.fr/~vayssade____ France
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 \---------------------------------------------------/
On Thu, 18 Oct 2001, Casey Duncan wrote:
<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>
This will work: <dtml-unless name="lg"> <dtml-call expr="REQUEST.set('lg','fr')"> </dtml-unless>
fine. thank you -- _/ _/ _/_/_/ _/_/ Michel.Vayssade@UTC.fr Service Informatique _/ _/ _/ _/ T:33/0-3.44.23.49.24 Universite de Technologie _/ _/ _/ _/ F:33/0-3.44.23.46.77 BP 20.529 60205 Compiegne _/_/ _/ _/_/ _ mv@utc.fr __/www.utc.fr/~vayssade____ France
participants (2)
-
Casey Duncan -
Michel Vayssade