Re: [Zope] Unless not quite the opposite of if?

2000-06-12 Thread Curtis Maloney

On Sat, 10 Jun 2000, Bill Anderson wrote:

 Quickie: Does _anything_ in the tree above the page have 'paramName'?
 IOW, say you are in /A/B/C. If A has paramName, and you test for it in
 C, it will return true.


A good call, but no.  Especially invalidated by the fact the same problem 
showed with FSSession.


 Just a stab in the dark...

Yeh.. I've seen the Acquision monster bight a few people... but not this time.

oh well... back to the sub-optimal solution.

-- 
Have a better one,
Curtis.

dtml-var standard_work_disclaimer

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Unless not quite the opposite of if?

2000-06-09 Thread Dieter Maurer

Curtis Maloney writes:
  On Fri, 09 Jun 2000, Dieter Maurer wrote:
   Curtis Maloney writes:
  ... dtml-unless does not work ...
  
   ... Seems that you make something wrong ...
  
  It doesn't.  Really.  I'm certain of this.  The key was not there, and yet 
  the unless was not rendered.  This is why I'm posting.  It's not working as 
  it should.
  
  I guess I'm funny like that.  I only post problems when they exist.

Sorry!
But some problem reports are difficult to believe.

I tried the following DTML-method with Zope 2.1.6:

dtml-var standard_html_header
dtml-unless "0"should renderbr/dtml-unless
dtml-unless "1"should not render/dtml-unless
dtml-unless "REQUEST.has_key('XXX')"should renderbr/dtml-unless
dtml-call "REQUEST.set('XXX',1)"
dtml-unless "REQUEST.has_key('XXX')"should not render/dtml-unless
dtml-var standard_html_footer

It worked as expected.

No hint that "dtml-unless" could be faulty.


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Unless not quite the opposite of if?

2000-06-08 Thread Dieter Maurer

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

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Unless not quite the opposite of if?

2000-06-08 Thread Curtis Maloney

On Fri, 09 Jun 2000, Dieter Maurer wrote:
 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'.

It doesn't.  Really.  I'm certain of this.  The key was not there, and yet 
the unless was not rendered.  This is why I'm posting.  It's not working as 
it should.

I guess I'm funny like that.  I only post problems when they exist.


   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.


Well, this is my point.   The body was NOT being rendered.


Just to follow this,  I'm now using

dtml-if "FSSession.has_key('ReturnerID')" 
  normal page contents
dtml-else
  handle it otherswise.
/dtml-if

and it is working fine.  However, since the handle it otherwise stuff is a 
redirect, I'd much rather just use an unless at the start of my page.


 Dieter

-- 
Have a better one,
Curtis.

dtml-var standard_work_disclaimer

___
Zope maillist  -  [EMAIL PROTECTED]
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 )