On April 29, 2002 06:52 am, Terrel Shumway wrote: > On Fri, 2002-04-26 at 18:56, Tavis Rudd wrote: > > The code in ServletFactory.importAsPackage() and > > ServletFactory._importModuleFromDirectory could be refactored to allow it > > to work with import hooks and remove the need for a separate > > ServletFactory for each extension. It should be possible to use a single > > ServletFactory for .py, .psp, and .tmpl servlets once the refactoring has > > been done and an import hook has been written for .psp files. > > An even better idea would be to factor out the import code (remove > importAsPackage entirely from the ServletFactory interface or move it > down into PythonServletFactory), separate it from imp (as you > suggested), and make it available as a Loader class, to which > PythonServletFactory and others could delegate as necessary. > > Removing the need for separate ServletFactory for each extension would > defeat the primary purpose of its design.
I'm not suggesting one ServletFactory for all extensions; rather, allowing multiple extensions to be explicitly mapped to one type of ServletFactory in cases where it makes sense. ServletFactories should map to how Python sees a file, not to its extension. Once an import hook has been installed, .tmpl and .psp files ARE PythonServlets. Python treats them as such, so should WebKit. It's not a huge issue, but why require more code when you can do the same with less? Tavis _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss