Dieter Maurer writes:
Today, I incorporated our Zope extensions into Zope 2.7 and had to determine how I can provide the necessary configuration through ZConfig. I feel the configuration process is not yet as modular as it should be?
There's certainly room for improvement.
Let's explain what extensions I have:
1. an alternate "Transience" implementation for Zope sessions
I don't know how the session machinery works in Zope; if there's a section to configure that at all, it should at least be easy to make it possible to provide an alternate section type that can be used. What changes did you need to make to Zope to make this configurable?
2. a new log handler "rotated_logfile" (which performs automatic daily rotation with log files named "prefix.date")
This doesn't need any changes in zLOG; you should be able to provide a new component and use %import to load it in the configuration.
3. a common piece of configuration used for communication between Zope and a "checkZope" process (which supervises that Zope responds sufficiently fast)
I solved 1 and 2 by rudely modifying Zope sources ("zLOG/component.xml" and associated "handlers", "Zope/Startup/zopeschema.xml" and associated "handlers"). I do not yet have a solution for 3 but I probably will give the "checkZope" process the complete Zope schema and configuration file.
I'm not sure why you want the checkZope process to load Zope's configuration at all. Can't you just use a separate configuration file? If there are portions that need to be shared, you can place those in a separate file and %include that into the Zope and checkZope configurations.
Almost surely, it would not have been necessary to modify the "zLOG" configuration to get a "rotated_logfile" because components and sectiontypes provide enough modularity.
Yup.
However, schemas and configuration files seem not to be modular.
Not terribly, no. That wasn't a requirement that anyone made me away of at the time. Bits of configuration files can be stored in separate files and composed using %include.
I would like to compose schemas and configuration files from components: e.g. combine the standard Zope schema and a small schema for our extensions to form the schema used by the extended Zope, combine the configuration file from long living Zope settings (maintained in CVS), instance specific Zope settings (locally maintained) and configuration fragments used by Zope and other components (e.g. the "checkZope" process).
One approach we've taken on some projects is to place all settings within sections, leaving the top-level as a place to put the sections. This wasn't done for the main Zope schema due to various forces; perhaps that was a mistake.
I think, a general "include" function for schemas (including not only types but complete schemas) and configuration files could provide this kind of modularity.
Have you looked at the <schema extends="..."> support Phillip Eby added? -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation