[Zope] templates, html-input form, html-display form

asouzaleite@gmx.de asouzaleite@gmx.de
Thu, 3 Oct 2002 22:09:50 +0200 (MEST)


This is a MIME encapsulated multipart message -
please use a MIME-compliant e-mail program to open it.

Dies ist eine mehrteilige Nachricht im MIME-Format -
bitte verwenden Sie zum Lesen ein MIME-konformes Mailprogramm.

--========GMXBoundary143461033675790
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Zopistas,

I am a newbie, reading Chapter 3 of the Zope Book, Basic Objects. The
following example doesn't seem to work on my Zope system ( I don't understand the
error
message):

------------------------------------------------------------------------------------------------------------------
template
interestRateForm:
------------------------------------------------------------------------------------------------------------------
<html>
<body>

<form action="interestRateDisplay" method="POST">
<p>Please enter the following information:</p>

Your current balance (or debt): <input name="principal:float"><br>
Your annual interest rate: <input name="interest_rate:float"><br>
Number of periods in a year: <input name="periods:int"><br>
Number of years: <input name="years:int"><br>
<input type="submit" value=" Calculate
"><br>
</form>

</body>
</html>
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
template
interestRateDisplay:
------------------------------------------------------------------------------------------------------------------
<<html>
<body>

<p>Your total balance (or debt) including compounded interest over
  <span tal:content="years">2</span> years is:</p>
<p><b>$<span tal:content="python: here.calculateCompoundInterest(principal, 
                                                     interest_rate,
                                                     periods,
                                                     years)"
>1.00</span></b></p>

</body>
</html>

------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
PythonScript
calculateCompoundInterest:
------------------------------------------------------------------------------------------------------------------

""" 
Calculate compounding interest.
"""
i = interest_rate / periods
n = periods * years
return ((1 + i) ** n) *
principal
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Error:
------------------------------------------------------------------------------------------------------------------
Traceback (innermost last):
  File /usr/local/zope/Zope-2.5.1-src/lib/python/ZPublisher/Publish.py, line
150, in publish_module
  File /usr/local/zope/Zope-2.5.1-src/lib/python/ZPublisher/Publish.py, line
114, in publish
  File /usr/local/zope/Zope-2.5.1-src/lib/python/Zope/__init__.py, line 159,
in zpublisher_exception_hook
    (Object: failed_example_01)
  File /usr/local/zope/Zope-2.5.1-src/lib/python/ZPublisher/Publish.py, line
89, in publish
  File /usr/local/zope/Zope-2.5.1-src/lib/python/ZPublisher/BaseRequest.py,
line 308, in traverse
  File /usr/local/zope/Zope-2.5.1-src/lib/python/ZPublisher/HTTPResponse.py,
line 502, in debugError
NotFound: (see
above)
------------------------------------------------------------------------------------------------------------------

--========GMXBoundary143461033675790
Content-Type: application/octet-stream; name="failed_example_01.zexp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="failed_example_01.zexp"

WkVYUAAAAAAAAB7HAAAAAAAAAgwoKFUKT0ZTLkZvbGRlcnEBVQZGb2xkZXJxAnRxA050Ln1xBChV
EGludGVyZXN0UmF0ZUZvcm1xBShVCAAAAAAAAB7LcQYoVSdQcm9kdWN0cy5QYWdlVGVtcGxhdGVz
LlpvcGVQYWdlVGVtcGxhdGVxB1UQWm9wZVBhZ2VUZW1wbGF0ZXEIdHRRVQJpZHEJVRFmYWlsZWRf
ZXhhbXBsZV8wMXEKVRJfX2FjX2xvY2FsX3JvbGVzX19xC31xDFUJd29ydGtsYW5ncQ1dcQ5VBU93
bmVycQ9hc1UIX29iamVjdHNxECh9cREoVQltZXRhX3R5cGVxElUPU2NyaXB0IChQeXRob24pcRNo
CVUZY2FsY3VsYXRlQ29tcG91bmRJbnRlcmVzdHEUdX1xFShoElUNUGFnZSBUZW1wbGF0ZXEWaAlV
EGludGVyZXN0UmF0ZUZvcm1xF3V9cRgoaBJoFmgJVRNpbnRlcmVzdFJhZ2VEaXNwbGF5cRl1dFUF
dGl0bGVxGlURem9wZSBib29rIGV4YW1wbGVxG2gUKFUIAAAAAAAAHspxHChVI1Byb2R1Y3RzLlB5
dGhvblNjcmlwdHMuUHl0aG9uU2NyaXB0cR1VDFB5dGhvblNjcmlwdHEedHRRaBkoVQgAAAAAAAAe
zHEfKGgHVRBab3B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