Enabling versioning to Dexterity content types
Introduction
Versioning is provided in Plone by two packages:
- Products.CMFEditions: provide the core versioning functions.
- Products.CMFDiffTool: makes possible to compare two versions of a content item.
Both work "out of the box" with the standard Plone content types, which are based on Archetypes. To enable versioning for a Dexterity content type it's needed to install some dependencies and do some configuration.
Required packages
To enable versioning on a Dexterity content type you need to have the following packages on your buildout:
- plone.app.versioningbehavior: Provides a behavior to enable versioning on a content type by making CMFEditions aware of changes in the content items.
- collective.cmfeditionsdexteritycompat: Adjust CMFEditions to work better with Dexterity content types.
- collective.dexteritydiff: Makes CMFDiffTool work with Dexterity content types.
Configuration
Once the required packages are available on your buildout, do the following:
- Apply the GenericSetup profile of collective.dexteritydiff on the Plone Site.
- Go to the types control panel (@@types-controlpanel) and set the versioning option for the content type to automatic or manual.
- Go to the portal_diff tool page on the ZMI.
- Add Compound Diff for Dexterity types for the content type. Field name can be anything, e.g: "any".
That's it. If you want to do this configuration on the file system (i.e on the Python package containing the content type) then you must:
- Declare the required packages as dependencies on setup.py.
- Make the GenericSetup profile of your package depends on the profile of collective.dexteritydiff in your metadata.xml.
- Check the Enabling versioning on your custom content-types appendix of the Plone developer manual. It is for Archetypes-based content types, but adaptation for Dexterity is straight-forward.
Known issues and pitfalls
- Needs more real world usage/testing/feedback.
- There's no support for blob-based fields. Non-blob-based file and image fields are OK.
