Automated Program Configuration for Plone products

If the application of a Plone page is mainly defined by a personal product it is helpful to partially swap the installation and configuration. The following article shows a couple of examples that should serve as incitement.

Manual Product Configuration

When developing new products for the Plone CMS, it is generally impossible to bypass designing new types of content and articles. The starting aid used in this case are the so-called archetypes. Once the article type is finished it must be defined for the Plone page with the assistance of the Zope Managment Interface (ZMI). This is facilitated using the archetypes_tool, as shown in the image below.

Automated Product Configuration

When installing a Plone product, the system scans for the install.py Python script, located in the Extensions sub-directory of the product directory. This script controls the installation of the product.

One can use this Python script in order to automate certain steps of the configuration of a Plone page. The installation of the new content types is retained after a single installation, however, there are certain steps necessary before a proper reinstallation process has taken place. One such step, for example, is the configuration of the MailHost or the activation of portal_factory for the new atricle types. Since during the course of the development of a product one must go through the execution of this cycle rather often, it makes sense to integrate these settings in the install.py file. The following code snippets are to be considered a sample.

Coniguration and installation of the article types via the archetype_tool:

Configuration of MailHost:

Configuration of portal_factory for the new types:

Conclusion

With Extensions/install.py one has the possibility to address all Portal configuration entries on a code level. This is particularly useful when, e.g., a product is to be used on multiple Zope instances. If the configuration actually takes place on a code level, the product can be easily distributed without needing further manual adjustments in the ZMI. Generally, this practice is also used in order to deliver, e.g., workflows additionally to the program. It is certainly also possible to automatically install further products that can work conjunctly and be installed via the portal_quickinstaller. There are virtually no limits as to the possibilities for application.