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 allo=
w it
> > to work with import hooks and remove the need for a separate
> > ServletFactory for each extension. It should be possible to use a si=
ngle
> > 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, allowin=
g=20
multiple extensions to be explicitly mapped to one type of ServletFactory=
in=20
cases where it makes sense.=20
ServletFactories should map to how Python sees a file, not to its extensi=
on.=20
Once an import hook has been installed, .tmpl and .psp files ARE=20
PythonServlets. Python treats them as such, so should WebKit. =20
It's not a huge issue, but why require more code when you can do the same=
with=20
less?
Tavis
|