All pastes #827598 Raw Edit

Untitled

public text v1 · immutable
#827598 ·published 2007-12-21 21:40 UTC
rendered paste body
from zope.component import getUtility
from zope.component import getMultiAdapter
from plone.portlets.interfaces import IPortletManager
from plone.portlets.interfaces import IPortletAssignmentMapping

def setupVarious(context):
    
    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a 
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.
    
    if context.readDataFile('arboco.theme_various.txt') is None:
        return
        
    # Add additional setup code here
    site = context.getSite()
    column = getUtility(IPortletManager, name=u'plone.rightcolumn', context=site)
    manager = getMultiAdapter((site, column,), IPortletAssignmentMapping)
    for name, portlet in list(manager.keys()):
        if portlet.title in [u"Events", u"Calendar"]:
            del manager[name]