[Zope] Invalid Literal for Int()

Thomas B. Passin tpassin@mitretek.org
Mon, 7 Jan 2002 14:54:22 -0500


[Ben Ocean]

> I have a form in which I create a variable like this:
>
> <dtml-call "REQUEST.set('shipping',_.int(subtotal)*.05)">
> <input type=hidden name=shipping value=<dtml-var shipping>>
>
> which is successfully used in said form like this:
>
>   <dtml-if shipping>
>    <tr>
>     <td><font style="font: <dtml-var "sizeCalc(15,size(_.None,_))">px
> verdana">Shipping:</font></td>
>     <td><font style="font: <dtml-var "sizeCalc(15,size(_.None,_))">px
> verdana"><dtml-var shipping fmt=dollars-and-cents></font></td>
>    </tr>
>   </dtml-if>
>
> but when I try to render it in the form to which I pass it like this:
>
>   <dtml-if shipping>
>     <tr>
>      <td><font style="font: <dtml-var "sizeCalc(15,size(_.None,_))">px
> verdana">Shipping</font></td>
>      <td>&nbsp;</td>
>      <td>&nbsp;</td>
>      <td><font style="font: <dtml-var "sizeCalc(15,size(_.None,_))">px
> verdana"><dtml-var shipping fmt=dollars-and-cents></font></td>
>     </tr>
>   </dtml-if>
>
> it doesn't render at all!

Just what is it that doesn't render?  The font element, the value of
"shipping", or what? By "render", I take it that you mean it does not appear
in the html output as seen by the browser.  Is that right?  Or do you mean
that the text is invisible?  What does the browser receive?

Seems to me that it would be good to print out exactly what the various
parts are.  Thus, get rid of the <font> element (temporarily at least), add
<dtml-var shipping> and <dtml-var sizeCalc(15,size(_.None,_))"> elements,
and see exactly what the browser is really receiving.  You can go on from
there.

Cheers,

Tom P

PS.  I strongly suggest that you specify your font sizes in percentages and
not pixels for better readability over a range of browsers and settings.  I
also recommend specifying the size once (in a <style> element) rather than
each place you may want to use it.