[Zope] Unless not quite the opposite of if?
Dieter Maurer
dieter@handshake.de
Thu, 8 Jun 2000 21:22:21 +0200 (CEST)
Curtis Maloney writes:
> On Thu, 08 Jun 2000, Curtis Maloney wrote:
> > ...
> > The problem is, when i test the page, it seems to pass over that that, and
> > go right on with the page. So, I tried to be a little more explicit:
> >
> > <dtml-unless "REQUEST.has_key('parmName')">
> > ...
> > </dtml-unless>
> >
> > <dtml-if parmName>
> >
> > (as I have done in MANY cases), it always evaluates true if 'parmName'
> > exists in the current context.
That is consistent!
"unless" is equivalent to "if not".
When "if" evaluate to "true", "unless" will skip its body and
vice versa.
'if var' evaluates to "true", if "var" exists and has a (Python) true
value.
Seems that your request really has a key 'parmName'.
> And worse still, I've now decided to use the FSSession, and the following
> line is evaluating true when it shouldn't:
>
> <dtml-unless "FSSession.has_key('ReturnerID')">
>
> Since no FSSession keys have been set, this should evaluate FALSE.
The "FSSession.has_key('ReturnerID')" should of cause yield "false".
This means, the "dtml-unless" body is rendered.
Dieter