[Zope] int and string comparisons

Seb Bacon sebbacon@email.com
Thu, 12 Oct 2000 10:13:39 +0100


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: rudd-o@usm.edu.ec [mailto:rudd-o@usm.edu.ec]On Behalf Of Manuel Amador
(Rudd-O)
Sent: 12 October 2000 09:12
To: zope@zope.org
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-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)