At 04:22 PM 10/24/01 -0400, Geoff Talvola wrote: >That brings up the larger question of "where do I put resources that are >global to the application?" > >I usually just put stuff like that into regular Python modules. Then >whenever I need it, I just import the module (at which time it gets >initialized) and use it. Sometimes I put in some helper methods into >SitePage to make it more convenient to use within servlets. > >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.
(following up on my own message) And as others have suggested, a Kit is the place to put this db code. If the Kit's job is to simply augment Application with new methods, then it may be as simple as a DbMixin.py module that defines a DbMixin class with the new methods, a Properties.py file like the other Kits, and an __init__.py like this (completely untested): # This function gets called by the app server during initialization def InstallInWebKit(appServer): # See if DbKit was enabled if appServer.setting('EnableDbKit', 0): # Mix in our DbMixin class into Application from WebKit.Application import Application from DbMixin import DbMixin from MiscUtils.MixIn import MixIn MixIn(Application, DbMixin) -- - Geoff Talvola [EMAIL PROTECTED] _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss