On Sunday January 27, 2002 12:32 am, Edmund Lian wrote:
> Geoff wrote:
> >>Application maintains a list of shutdown handlers, so if you call
> addShutDownHandler multiple times each of the functions will get called, in
> the order that you called addShutDownHandler.<<
> Come to think of it, it might actually be useful to have the counterpart of
> this (start up handlers) so that we can add functions for auto execution at
> server startup. This would certainly be helpful for kicking off background
> tasks, opening up db global connection pools, etc.
You can actually already accomplish this by putting a function called
contextInitialize(app, path) into the __init__.py of your context. The
__init__.py gets imported when the appserver starts up, and then if there is
a contextInitialize function in there, it will call that function. That's a good
place to initialize any global stuff needed by the context, and it's also a
good place to call app.addShutDownHandler() to register the cleanup stuff.
I'm not sure if this particular fact is mentioned in the documentation,
though. I think Webware's documentation is generally pretty good for what it
covers, but there's some features that aren't covered at all. That
needs to get addressed.