[Zope] 3RD REQUEST: PLEASE HELP
Dieter Maurer
dieter@handshake.de
Mon, 7 Jan 2002 20:23:16 +0100
Ben Ocean writes:
> ... successful ...
> <dtml-call "REQUEST.set('shipping',_.int(subtotal)*.05)">
> ...
> <dtml-var shipping fmt=dollars-and-cents>
> ... unsuccessful in action ...
> Error Type: ValueError
> Error Value: invalid literal for int(): 126.0
In the first (succesful) case, "shipping" is either a number data type
or a string representing an integer.
In the second case, you try to convert the string "126.0" into
an integer. This fails, because '.' can not be part of such a string.
Solution: convert first to 'float' and then to 'int'.
Dieter