[Zope] problem with python script

D. Rick Anderson ruger@comnett.net
Thu, 7 Feb 2002 13:43:10 -0800 (PST)


I am having a horrible time with a python script. The idea is to get a 
dollars-and-cents formatted string from the 3.87987234233e-1234 type string 
that the Sybase server is returning. The python script looks like this:
---
final = (float(int(float(number[0:10]) * 100)) / 100)

return final
---
with one parameter (number)

when I call it with either:
<dtml-call expr="numberTrim(number=cur_bal)">
or
<dtml-var expr="numberTrim(number=cur_bal)">

I get:
Error Type: TypeError
Error Value: unsliceable object

if I use the "test" at the top and enter a value it works fine and if I 
hard code a value it works as well. The only time it WON'T work is when 
it's called with the cur_bal variable. Has anybody ran into this before?

Thanks,

Rick