[Zope-it] integrazione script python

Simone Cian symba@level11.net
Wed, 4 Sep 2002 11:03:22 +0200


Buongiorno a tutti,
Sono un newbie di Zope, e sto cercando di "pasticciare" un pochino per
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="interestRateDisplay" method="POST">
<p>Please enter the following information:</p>
Your current balance (or debit): <input name="principal:float"><br>
Your annual interest rate: <input name="interest_rate:float"><br>
Number of periods in year: <input name="periods:int"><br>
Number of years: <input name="years:int"><br>
<input type="submit" value=" 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=
"calculateCompuondingInterest(principal,interest_rate,periods,years)" >
</b></p>
<dtml-var standard_html_footer>
********************************************

che richiama calculateCompoundingInterest che è un piccolo script in Python:
********************************************
##Script Python "calculateCompoundingInterst"
##paraameters=principal, interest_rate, periods, years

i = interest_rate / periods
n = periods * years
return ((1+i)**n)*principal
********************************************

Dunque il problema è questo: quando cerco di salvare interestRateDisplay
Zope mi genera un errore:

 invalid parameter: "=
"calculateCompoundingInterest(principal,interest_rate,periods,years)"", for
tag <dtml-var expr=
"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