[Zope] dtml-if problem

Eric Walstad ewalstad@energywright.com
Thu, 19 Oct 2000 14:17:45 -0700 (PDT)


Hi Terry - Disclaimer: I'm a Zope Newbie...
Here's what I'd try:

Length of the value of Area is: <dtml-var
expr="_.len(Area)"><br>
Length of the 'strip'ped value of Area is: <dtml-var
expr="_.len(_.string.strip(Area))"><br>

If you see somethinkg like:
Length of the value of Area is: 4 (or more)
Length of the 'strip'ped value of Area is: 3
when you view the DTML method, you have either white
space in your Area variable or a linefeed charater,
or...

If that's the case, here's a working if statement:
<dtml-if "_.string.strip(Area)=='BIS'">

You could also try:
<dtml-if "_.string.find(Area, 'BIS')>0">
which will search for an instance of 'BIS' in the
value of the Area variable

Hope it helps,

Eric.

// -----Original Message-----
// From: zope-admin@zope.org
[mailto:zope-admin@zope.org]On Behalf Of Terry
// Babbey
// Sent: Thursday, October 19, 2000 1:37 PM
// To: zope@zope.org
// Subject: [Zope] dtml-if problem
// 
// 
// The following will not evaluate true and I am
stumped again.
// 
// <dtml-if "Area == 'BIS'">
// 
// Area is a variable I am passing to my method and I
want to check to
// see if the variable is set to BIS, but it never
returns true even
// though a <dtml-var Area> displays BIS.
// 
// Confused as always,
// Terry
// 
// --
//
__________________________________________________________________
// Terry Babbey
// Technical Support Specialist
// Lambton College, Sarnia, Ontario, Canada
//
__________________________________________________________________
// 
// 
// 
// _______________________________________________
// 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 )
// 

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/