On Tuesday 13 May 2003 07:02 am, Erwin Ambrosch wrote:
But how can I test of non existens of nol. I would need something like
<dtml-if "_.has_key('nol') and (nol=='root' or nol=='' or !nol)">
If it "doesn't exist" then _.has_key('nol') would've evaluated false, and none of the rest of the statement matters. If it *does* exist, but is equal to a false value -- '', None, (), [], or 0 -- then "not nol" will be false (you don't want "!" -- that's either meaningless or a bitwise NOT, I can't remember, but not a logical NOT). Remember: python uses words to do logic and symbols to do math. (Actually I don't know if that's rigorously true, but it's a good rule of thumb for remembering how to do "if" expressions ;-) ). So you can probably write that: <dtml-if expr="_.has_key('nol') and (nol=='root' or not nol)"> or maybe you meant: <dtml-if expr="not _.has_key('nol') or not nol or nol=='root'"> which seems more logical: this will evaluate to true if there is no "nol" name, the name maps to a false value, or to the special value "root". Any other value will be false. My guess is that this is what you meant -- but only you know what you want. ;-) HTH, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com