# Python imports
from StringIO import StringIO
# CMF imports
from Products.CMFCore.utils import getToolByName
# Archetypes imports
from Products.Archetypes import listTypes
from Products.Archetypes.Extensions.utils import installTypes, install_subskin
# Products imports
from Products.CV.config import GLOBALS, PROJECTNAME
def install(self):
"""Install content types, skin layer, enable the portal factory
"""
out = StringIO()
print >> out, "Installing CV"
# Install types
classes = listTypes(PROJECTNAME)
installTypes(self, out,
classes,
PROJECTNAME)
print >> out, "Installed types"
# Install skin
install_subskin(self, out, GLOBALS)
print >> out, "Installed skin"
# Register types with portal_factory
factory = getToolByName(self, 'portal_factory')
types = factory.getFactoryTypes().keys()
if 'CV' not in types:
types.append('CV')
factory.manage_setPortalFactoryTypes(listOfTypeIds = types)
print >> out, "Added CV to portal_factory"
return out.getvalue()