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