You can put startup code in awake() and cleanup code in sleep() methods of a servlet.  These methods get called at the beginning and end of every request for that servlet.  For example:
class MyPage(Page):
    def awake(self, trans):
        Page.awake(self, trans)
        # your code goes here
    def sleep(self, trans):
        # Your cleanup code goes here
        Page.sleep(self, trans)
The servlets never get deleted until the app server is shut down -- they get reused instead.  That's why you have to put your cleanup code in sleep() instead of __del__().
- Geoff
-----Original Message-----
From: Meh Lounge []
Sent: Friday, October 22, 2004 9:46 AM
To: Geoffrey Talvola;
Subject: RE: [Webware-discuss] __del__ equivalent webware function

But how can I add this thing per servlet?
I'm having a servlet (or context) that opens a DB connection when started and need to close it when it is done. Can't I add a close() function to the context/servlet? this should be changed IMHO.

Geoffrey Talvola <> wrote:
Meh Lounge wrote:
> Can anyone please provide me with such function. How
> can I order webware to do thing when a servlet or when
> a context is closed?

You can call Application.addShutDownHandler(func) where func is any callable
object. It will be called when the app server is shut down.

- Geoff

This email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
Webware-discuss mailing list

Do you Yahoo!? - Register online to vote today!