At 04:22 PM 10/24/2001 -0400, Geoff Talvola wrote:
>But the compelling reason to put this directly into Application is so that 
>it can shutdown cleanly.  I haven't needed that up till now.
>
>So perhaps there needs to be a more general way to register stuff into 
>Application so that it initializes when the app starts up, is available 
>throughout the whole application, AND shuts down cleanly when the 
>appserver is stopped.
>
>But I still agree with Clark that specific stuff like this doesn't really 
>belong directly in Application; rather, there needs to be a plug-in 
>mechanism so that it's easy to add stuff like this into Application via a 
>configuration setting.  Like perhaps in Application.config, there could be 
>a list of Python files with mixins that automatically get applied to 
>Application.  Or a way to substitute your own derived version of 
>Application instead of the original Application.

I agree with this line of thought regarding modularity and ease of extension.

How about the idea of an "applet" which is an instance that can be attached 
to an application via either configuration or run time code (often found in 
your initializeContext() function)?


class Applet:

         def __init__(self):
                 self._app = None

         def app(self):
                 return self._app

         def name(self):
                 return self.__class__.__name__

         def wasInstalled(self, app):
                 self._app = app

         def shutDown(self):
                 pass

app.addApplet(MyApplet())


The application would maintain a list of these and send them all shutDown() 
when it shutdown.

Application.applet('foo') would return an applet by name, possibly 
returning a list in the case of name collisions. As the application 
developer you would decide if such name collisions would/could happen and 
either deal with it, or not.

Basically, this approach allows you to attach arbitrary instances to the 
application for whatever purposes you desire and hook into application 
level events like shutDown(). I'm not sure if there would be any other 
events in the future.

I'd also like to provide a file system structure for applications where it 
would be easy to drop in a custom subclass of Application for your project.

Inheritance and composition are both valid ways to extend a class and 
WebKit should make both easy for Application.

If Applet is well received and remains fairly simple, we could sneak it 
into the 0.6 release. If it's not well received or blows up in complexity 
(as these things often do), then we'd wait for 0.7.

Let the e-mails begin...

-Chuck


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to