[Zope] Tricky usage of string to integer conversion

Evan Simpson evan@4-am.com
Tue, 7 Mar 2000 09:12:22 -0500


----- Original Message -----
From: Brian K. Holdsworth <bhold@awod.com>
> I am trying to do the following:
>
> <dtml-let x:int="REQUEST.get('prod_config')"
>           item="_[REQUEST.get('prod_id')]"
>           price="item.price_list[x]">
>     <INPUT type="hidden" name="chargetotal" value="<dtml-var price>">
> </dtml-let>

"dtml-let" doesn't understand type annotations, so you are setting a
variable called 'x:int', which isn't what you want.  You need to do the
integer conversion in Python, like so:

<dtml-let x="_.int(REQUEST.get('prod_config')" ...>

See the DTML reference guide at zope.org for more useful methods of "_".

Cheers,

Evan @ digicool & 4-am