Dan Milstein wrote:
> What's the best way to get a block of code to run when the Webware
> server starts?
> Specifically, I'd like to create a bunch of Tasks and register them
> with the TaskKit Scheduler. But I'm not seeing where to configure that.
The __init__ of your context is one place. The App calls
contextInitialize() for each context, if the function is defined, and
passes itself, which you can use to get a reference to the Task Manager.
In your context's __init__.py file you can put:
def contextInitialize(app, contextPath):
''' Called by the WebKit Application whenever the context loads '''
# Add our application-wide tasks, if the appserver is persistent
taskMgr = app.taskManager()
taskMgr.addPeriodicAction( ... )
taskMgr.addTimedAction( ... )
hope that helps - Ben