Re: Re: [Myghty-users] substitution outputs nothing
Brought to you by:
zzzeek
From: Marty M. <mar...@ly...> - 2006-05-11 20:46:16
|
Okay, thank you very much for the information. I hope I don't sound to picky right now, but wouldn't it be better to output substitutions even if they evaluate to 0/False? Then you wouldn't have to do str(myInteger) or myInteger |h for every Integer that might result to zero. Maybe that would be more intuitive (I think there are some more people who have tripped over this already). Anyway, thanks and cheers, Martin > Von: "Deron Meranda" <der...@gm...> > An: "Marty McFly" <mar...@ly...> > Betreff: Re: [Myghty-users] substitution outputs nothing > Datum: Thu, 11 May 2006 13:46:53 -0400 > On 5/11/06, Marty McFly <mar...@ly...> wrote: > > Just recently, I've had the following small problem: A substitiution in > my > > template that results to zero, for example: > > <% 2-2 %> > > outputs nothing instead of 0. > > This is a known behavior. Substitutions will only generate output if > their values evaluate to True in the Python sense. The number 0 > is considered to be False. > > To force output, you need to do one of the following: > > <% 2-2 | h %> -- filters implicitly convert to string values > <% str 2-2 %> -- string '0' is not False like number 0 is > -- > Deron Meranda Stelle Deine Fragen bei Lycos iQ - http://iq.lycos.de/qa/ask/ |