Doesn't dtml have a function to do that? Check the zope book.
From: "D. Rick Anderson" <ruger@comnett.net> Reply-To: ruger@comnett.net Date: Thu, 7 Feb 2002 13:43:10 -0800 (PST) To: zope@zope.org Subject: [Zope] problem with python script
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
_______________________________________________ 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 )