Enable working copy support for custom types
by
Wyden Silvan
—
last modified
26.02.2010 17:17
Make a file in profiles/default/diff_tool.xml:
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType1">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
<type portal_type="MyCustomType2">
<field name="any" difftype="Compound Diff for AT types"/>
</type> </difftypes>
</object>
Add file Install.py
from StringIO import StringIO
from Products.CMFCore.utils import getToolByName
from Products.CMFEditions.setuphandlers import DEFAULT_POLICIES
# put your custom types in this list
TYPES_TO_VERSION = ('MyCustomType1','MyCustomType2')
def setVersionedTypes(portal):
portal_repository = getToolByName(portal, 'portal_repository')
versionable_types = list(portal_repository.getVersionableContentTypes())
for type_id in TYPES_TO_VERSION:
if type_id not in versionable_types:
# use append() to make sure we don't overwrite any
# content-types which may already be under version control
versionable_types.append(type_id)
# Add default versioning policies to the versioned type
for policy_id in DEFAULT_POLICIES:
portal_repository.addPolicyForContentType(type_id, policy_id)
portal_repository.setVersionableContentTypes(versionable_types)
def importVarious(context):
portal = context.getSite()
setVersionedTypes(portal
Add in __init__.py
def importVarious(context):
from Products.themewistar.Install import setVersionedTypes
portal = context.getSite()
setVersionedTypes(portal)
