[Zope-ZEO] Breaking ZServer dependence on ZPublisher

Greg Ward gward@mems-exchange.org
Wed, 6 Sep 2000 08:39:08 -0400


On 05 September 2000, Andrew Kuchling said:
> I'm still working on packaging ZEO, and am slowly making progress.
> The problem I've just hit is that ZServer doesn't work unless
> ZPublisher is installed:
[...]
> the problem.  I've found that commenting out the following block in
> ZServer/__init__.py fixes things, but it's a bit much:
> 
> #from HTTPServer import zhttp_server, zhttp_handler
> #from PCGIServer import PCGIServer
> #from FCGIServer import FCGIServer
> #from FTPServer import FTPServer
> #from PubCore import setNumberOfThreads
> #from medusa.monitor import secure_monitor_server

That the only thing left in ZServer/__init__.py would be Medusa and zLOG
stuff... which seems like exactly the right sort of stuff for ZServer to
provide and be concerned with.  It looks like these imports that you've
commented out are purely for convenience, so other Zope code can say

    from ZServer import PCGIServer

rather than

    from ZServer.PCGIServer import PCGIServer

which is nice, but hardly essential.

What confuses me is: why do these imports imply dependence on
ZPublisher?  Ahh, I see: PCGIServer.py imports HTTP{Request,Response}
from ZPublisher.  Presumably others do the same or similar.

Andrew, did you try selectively commenting out these imports in
ZServer/__init__.py?  Maybe not all of them have to go.  Would also be
interesting to see how much of the rest of Zope breaks if those imports
go away.  Or maybe the ZPublisher dependencies in those modules could be
isolated and turned into "lazy imports".  Technically they'd still
depend on ZPublisher, but at least you wouldn't die with an ImportError
as soon as you import anything in ZServer.

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange / CNRI                           voice: +1-703-262-5376
Reston, Virginia, USA                            fax: +1-703-262-5367