[Zope] int and string comparisons

2000-10-12 Thread Manuel Amador (Rudd-O)


This is the snippet
 dtml-in "_.range(1,32,1)">
 option value="dtml-sequence-item;"
 dtml-let item=sequence-item>
 dtml-if begin_day>
 dtml-if expr="item ==
REQUEST.begin_day"> selected /dtml-if>
dtml-comment>CONVERTIR A INT/dtml-comment>
 /dtml-if>
 /dtml-let>
 >dtml-sequence-item;/option>
 /dtml-in>
The comparison fails because item is an int and REQUEST.begin_day is
a string(i guess). How can I coerce item into a string, or
REQUEST.begin_day into an int?
I tried python's builtin int() function around REQUEST.begin_day.
Won't work.
Any suggestions?
--
Manuel Amador (Rudd-O)



Re: [Zope] int and string comparisons

2000-10-12 Thread Chris Withers

"Manuel Amador (Rudd-O)" wrote:
 dtml-if expr="item == REQUEST.begin_day" selected /dtml-if

Try replacing the above with:
dtml-if expr="item == _.int(REQUEST.begin_day)"

...and stop posting HTML to a non-HTML list!

cheers,

Chris

___
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] int and string comparisons

2000-10-12 Thread Seb Bacon

if you're submitting from a form, you can coerce strings into other data
types by giving the form items special names, e.g.:

input type=text name=foo:int
input type=text name=bar:float

Your REQUEST then has variables called foo and bar which are ints and
floats, respectively.

also, don't post html mail - not everyone can read it.

seb.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Manuel Amador
(Rudd-O)
Sent: 12 October 2000 09:12
To: [EMAIL PROTECTED]
Subject: [Zope] int and string comparisons


This is the snippet
   dtml-in "_.range(1,32,1)"
option value="dtml-sequence-item;"
dtml-let item=sequence-item
dtml-if begin_day
dtml-if expr="item == REQUEST.begin_day" selected /dtml-if
dtml-commentCONVERTIR A INT/dtml-comment
/dtml-if
/dtml-let
dtml-sequence-item;/option
  /dtml-in
The comparison fails because item is an int and REQUEST.begin_day is a
string (i guess).  How can I coerce item into a string, or REQUEST.begin_day
into an int?
 I tried python's builtin int() function around REQUEST.begin_day.  Won't
work.
Any suggestions?
--
Manuel Amador (Rudd-O)



___
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 )