Creating a Customization Policy
Customization Policies are used to collect all the setup for a deployable site in a central location.
This how-to is based on the process I used to create a customization policy for my own site. I tried to adopt the approach used in Plone already. Special thanks to Theuni for helping me with this.
A customization policy consists of a series of changes you want to make to a fresh Plone instance. Just about anything can be included, for example: security, default content, site properties, actions and skin settings. Take a look at the setup folder in CMFPlone for examples.
One policy, many components
In 2.0, you create a customization policy that consists of several setup methods. Each method does a distinct task, defined by you. The customization policy will run each of these widgets in an order defined by you.
The advantage to creating several setup methods is that they can be listed on the setup page of the portal_migrations tool. That way, you can run each of these methods individually, rather than having to run all of them at once. I found this very useful for testing purposes, if for nothing else.
So, what we want to do is:
- Create a set of setup methods as part of a
SetupWidgetclass and register it with the migration tool. - Create a customization policy class based on the default one, which calls our SetupWidget and register it with the portal tool.
Create the setup methods
- Create a folder in your product called
setup. - From CMFPlone/setup, copy the file called
ConfigurationMethods.pyto your own setup folder. This file will contain your setup methods. - Modify the ones there, or create your own methods. Each method needs to have the same arguments as follows:
def mySetupMethod(self, portal)