[Zope-it] integrazione script python

mberi@linkgroup.it mberi@linkgroup.it
Wed, 4 Sep 2002 11:07:15 +0200


Simone,
non so se hai fatto il taglia e incolla, in tal caso devi cambiare
calculateCompuondingInterest con calculateCompoundingInterest. Hai la o=
 e
la u invertite.
Ciao.
Marco.

On 04/09/2002 11:03:22 zope-it-admin wrote:

>  Buongiorno a tutti,
>  Sono un newbie di Zope, e sto cercando di "pasticciare" un pochino p=
er
>  vedere l'integrazione con gli script in Python...
>
>  Dunque il "the Zope Book" porta un esempio molto semplice che spiega=
 la
>  logica di programmazione con gli script:
>
>  si tratta di un modulo Web che calcola gli interessi composti dei
debiti.
>
>  Creo un Metodo DTML chiamato interestRateForm:
>  ******************************************
>  <dtml-var standard_html_header>
>  <form action=3D"interestRateDisplay" method=3D"POST">
>  <p>Please enter the following information:</p>
>  Your current balance (or debit): <input name=3D"principal:float"><br=
>
>  Your annual interest rate: <input name=3D"interest_rate:float"><br>
>  Number of periods in year: <input name=3D"periods:int"><br>
>  Number of years: <input name=3D"years:int"><br>
>  <input type=3D"submit" value=3D" Calculate "<br>
>  </form>
>  <dtml-var standard_html_footer>
>  *******************************************
>
>  Il metodo richiama interestRateDisplay che contiene:
>  *******************************************
>  <dtml-var standard_html_header>
>  <p>Your total balance (or debit) including compounded interest over
>  <dtml-var years> years is:</p>
>  <p><b><dtml-var expr=3D
>  "calculateCompuondingInterest(principal,interest_rate,periods,years)=
" >
>  </b></p>
>  <dtml-var standard_html_footer>
>  ********************************************
>
>  che richiama calculateCompoundingInterest che =E8 un piccolo script =
in
Python:
>  ********************************************
>  ##Script Python "calculateCompoundingInterst"
>  ##paraameters=3Dprincipal, interest_rate, periods, years
>
>  i =3D interest_rate / periods
>  n =3D periods * years
>  return ((1+i)**n)*principal
>  ********************************************
>
>  Dunque il problema =E8 questo: quando cerco di salvare interestRateD=
isplay
>  Zope mi genera un errore:
>
>  invalid parameter: "=3D
>  "calculateCompoundingInterest(principal,interest_rate,periods,years)=
"",
for
>  tag <dtml-var expr=3D
>  "calculateCompoundingInterest(principal,interest_rate,periods,years)=
" >,
on
>  line 4 of interestRateDisplay
>
>  dove sto sbagliando?
>
>  Grazie.
>  Symba
>
>  mail  - symba@level11.net
>  info  -  http://www.airy.it
>  fun   -  http://www.level11.net
>
>
>
>
>  _______________________________________________
>  Zope-it maillist  -  Zope-it@zope.org
>  http://lists.zope.org/mailman/listinfo/zope-it
=