[Zope-dev] zope.app.publication dependencies (volunteers needed!)

Chris McDonough chrism at plope.com
Thu May 14 18:09:15 EDT 2009

On 5/13/09 1:55 PM, Martijn Faassen wrote:
> Hi there,
> zope.app.publisher is depended on by quite a bit of code that uses the
> Zope Toolkit, as it defines  brower:view and browser:resource and the like.
> Unfortunately zope.app.publisher currently depends on more than 60
> packages. This is rather excessive, and we'd like to cut down on this.
> Also interesting about zope.app.publisher is that while it defines a
> 'browser' directory it actually doesn't contain any ZMI code; instead
> ZCML directives are defined there. Refactoring so the ZMI isn't around
> anymore is usually a good first step, but that's not needed here.
> If you look at the dependency graph for zope.app.publisher the task of
> fixing this looks daunting:
> http://startifact.com/depgraphs/zope.app.publisher.svg
> But now please observe the following:
> http://startifact.com/depgraphs/zope_app_publisher_cycles.svg
> This identifies the main cycles in that dependency graph. If we break
> those in the right way, we can cut down a lot of dependencies in one go.
> Getting rid of the zope.app.form and zope.formlib dependencies looks
> like a sensible step.
>   From this little graph, it looks clear we could do some of the
> following things (research is needed to see how difficult they are):
> * cut the dependency of zope.app.publisher on zope.app.component
> * OR cut the dependency of zope.app.component on zope.formlib
> * cut the dependency of zope.app.publisher on zope.app.publication
> * OR cut the dependency of zope.app.component on zope.app.security
> * cut the dependency of zope.app.publisher on zope.app.publication
> * OR cut the dependency of zope.app.publication on zope.app.exception
> * OR cut the dependency of zope.app.exception on zope.formlib
> There are probably a few more options there, but given that small graph,
> you get the picture.
> Any volunteers to do this research on how hard some of these steps would
> look and report back here? Once we've discussed the options we can
> proceed fixing the problem.

I did a bit of research on the direct "zope.app.*" dependencies of zope.formlib.

- I was able to get rid of a dependency on zope.app.container by
   requiring zope.browser>=1.1 (which Tres released yesterday);
   this package now has the ``IAdding`` interface that zope.formlib
   relies upon.

- I looked into its dependency on zope.app.pagetemplate.
   It defines two "named templates" in its form.py module using
   The ViewPageTemplateFile class from zope.app.pagetemplate.
   Each is registered in its configure.zcml as adapter with the
   name "default". I don't have enough zen to know what the intent
   is here or whether the named templates could use
   zope.pagetemplate instead.

- I looked into its dependency on zope.app.form.  It
   essentially uses a bunch of interfaces from the
   zope.app.form.interfaces package.  I don't know whether it
   would be reasonable to move all those interfaces
   to zope.browser or somewhere else, but essentially
   moving those interfaces to somewhere "neutral"
   would break this particular dependency.

- C

More information about the Zope-Dev mailing list