[Zope] dtml-if Newbie Question

Alfredo P. Ricafort alpot@mylinuxsite.com
05 Nov 2002 21:12:15 +0800


I just found out that the error is not due to dtml-if.  It was caused by
the wrong use of dtml-let. Anyway, thank you guys.

AL

On Tue, 2002-11-05 at 20:45, Oliver Marx wrote:
> Alfredo P. Ricafort wrote:
> 
> > Hi,
> >
> > >From the 'Zope Book' the statement
> >
> >
> >
> > means that 'if the..variable does not exist, then this condition is
> > false'.
> >
> > I found that this is not true.  When I tried using dtml-if to a
> > non-existent variable, I got a 'key error'. So how do I check if the
> > variable does not exist ?
> >
> > Tks.
> >
> > AL
> 
> 
> Are you sure that you did not try:
> 
> <dtml-if expr="var_name">
> 	Something
> </dtml>
> 
> Because it is *not* the same as:
> 
> <dtml-if var_name>
> 	Something
> </dtml-if>
> 
> The first example is Python-like in behavior. You get a key error if 
> var_name does not exist. The second example should work even if var_name 
> is not defined AFAIK.
> 
> \Oliver
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )