# -*- coding: utf-8 # Copyright 2005 by Meelis Mets """ Krihvel customization policy for Plone Sites """ __author__ = 'Meelis Mets' __doc__ = 'Site custimizing policy' from Products.CMFPlone.Portal import addPolicy from Products.CMFPlone.interfaces.CustomizationPolicy import ICustomizationPolicy from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy from Products.CMFCore.utils import getToolByName from StringIO import StringIO class KrihvelSitePolicy(DefaultCustomizationPolicy): """ Customizes a fresh Plone site to out needs """ __implements__ = ICustomizationPolicy availableAtConstruction = 1 def customize(self, portal): #customization code goes here out = StringIO() try: DefaultCustomizationPolicy.customize(self, portal) except KeyError: pass #portal.manage_changeProperties(title="Welcome to Krihvel") mi_tool = getToolByName(portal, 'portal_migration') gs = mi_tool._getWidget('Krihvel Setup') gs.addItems(gs.available()) return out.getvalue() def register(context, app_state): addPolicy('Krihvel', KrihvelSitePolicy())