[Zope] Converting a string to an int

Timothy Grant tjg@avalongroup.net
Mon, 30 Aug 1999 19:53:25 -0700


Hi,

I'm working with a form that allows users to enter quantities. Into a
table.

on the next form, if I use <dtml-var "_[Category + '_qty']"> I get the
value from the previous form exactly as I had planned--sortof. I then
proceeded to do some calculations based on this variable and was told
that I couldn't because it was a string. No problem thought I, I'll
convert it to an integer and I used the following code to do so.

<dtml-call "REQUEST.set('qty', _.string.atoi(_[Category + '_qty']))">

However, when I access the form, I get a Zope error that says:
Error type:  ValueError
Error value: invalid literal for atoi()

So, while it displays correctly, it does not appear to be a string, or
an int: what is it?

I have wondered if there was some weird translation error working with
the _[Category...] stuff, so I assigned the result of _[Category...] to
another variable and tried operating on it with the same result.

Any clues would be appreciated.

-- 
Stand Fast,
    tjg.

Red Hat Certified Engineer                 tjg@avalongroup.net
Chief Technology Officer                   www.avalongroup.net
Avalon Technology Group, Inc.                   (503) 246-3630
>>>>>>>>>>>>Exceptional Minds, Innovative Products<<<<<<<<<<<<