[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Using Basic Zope Objects

nobody@nowhere.com nobody@nowhere.com
Sat, 21 Sep 2002 14:52:17 -0400

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/BasicObject.stx#2-58


    This form collects information and calls the *interestRateDisplay*
    template.  Now, create a Python-based script called
    *calculateCompoundingInterest* that accepts four parameters,
    "principal", "interest_rate", "periods" and "years" with the
    following python code::

      ## Script (Python) "calculateCompoundInterest"
      ##parameters=principal, interest_rate, periods, years
      Calculate compounding interest.
      i = interest_rate / periods
      n = periods * years
      return ((1 + i) ** n) * principal 

      % Anonymous User - July 25, 2002 4:25 pm:

       I did exactly as instructed here. However, I got "Error Type: Undefined
        Error Value: years not found in 'years', at line 5, column 3
       ." It seems that Python script is not getting the parm "years." Anybody knows why?

      % Anonymous User - July 27, 2002 1:24 pm:
       I had the same problem. Solved by hacking not by science :(
       I change the variable 'years' to 'yrs' and it worked.
       Maybe the illuminati founding fathers can shed some light...

      % Anonymous User - July 27, 2002 2:50 pm:
       Apologize for the previous information  had the page in the cache  
       It does not work!

      % Anonymous User - Aug. 13, 2002 3:49 am:
       I'm having the same problem but I don't think the problem is in the python script I think its in the
       interestRateDisplay file. I wonder if I'm having this problem because I'm running win98.

      % Anonymous User - Aug. 28, 2002 7:35 pm:
       Don't forget to enter param names into the Parameter List field  on the script edit form 
       (it should look like  

       Parameter List [principal, interest_rate, periods, years]

       where [ and ] mean the boundaries of entry box

      % Anonymous User - Sep. 21, 2002 2:52 pm:
       Are the "##" lines convention or do they carry any semantic significance?