[Zope] Newbie: help with Zope Book script error

Robert H. Boyd rhboyd@ned.gsfc.nasa.gov
Mon, 05 Mar 2001 15:43:46 -0500


Greetings,

I'm not having success with the Zope Book ch 3 script example. First,
I've noticed it has the formula wrong in the script.

Original: 
i = interest_rate * periods  # (don't I wish my bank would do this :)
i = i + 1
n = periods * years
return pow((1 + i), n) * principal # already added 1 to i above

Correct:
i = interest_rate / periods
i = i + 1
n = periods * years
return pow(i, n) * principal

BUT, even with that, submitting the form returns an error of "not enough
arguments: expected four, got 0".  In the Zope manager, on the editor
for script calculateCompoundingInterest, I have entered principal,
interest_rate, periods, years in the parameters field.  The form page
has these same params specified as input fields; I don't know much about
Zope but I'd guess that Zope should understand that each named input
field is a parameter name, accompanied by its value.  So what is going
wrong?  Does the script itself need to look more like a regular Python
function, ala 'def calculateCompoundingInterest(principal,
interest_rate, periods, years):' ? Or is <dtml-var
calculateCompoundingInterest> not the correct way to call a script from
a page?

TIA, 
Robert Boyd