I generally agree, but if I were doing this, I might put my calculations in
awake() (making sure I call super) and have my PSPs override writeBody().
Or you could make a SitePage class whose awake() invokes self.calculate()
if that adds clarity.
This is just style, I guess.
At 12:02 PM 10/24/00 -0400, Geoff Talvola wrote:
>Can I just say that deriving a PSP from a servlet base class is great?
>It's a great way to separate the logic from the presentation. Put the
>data preparation in the servlet base class, and have that class call a
>method that you define in the derived PSP class.
>Here's a dumb but hopefully illustrative example of the kind of stuff
>from Page import Page
> def writeBody(self):
> # Do a bunch of database lookup and calculations in Python
> self.a = 123 + 456
> self.b = 5.123 * 98.7
> # Now render it using a psp "template"
><%@ page extends="MyReport" %>
><%@ page method="writeReport" %>
><br>a equals <%= self.a %>
><br>b equals <%= self.b %>
>- Geoff Talvola
> Parlance Corporation
>Webware-discuss mailing list