Exemple #1
0
def convertLegacyPortlets(context):
    """Convert portlets defined in left_slots and right_slots at the portal
    root to use plone.portlets. Also block portlets in the Members folder.

    Note - there may be other portlets defined elsewhere. These will require
    manual upgrade from the @@manage-portlets view. This is to avoid a
    full walk of the portal (i.e. waking up every single object) looking for
    potential left_slots/right_slots!
    """
    portal = getToolByName(context, 'portal_url').getPortalObject()
    convert_legacy_portlets(portal)
    logger.info('Converted legacy portlets at the portal root')
    logger.info('NOTE: You may need to convert other portlets manually.')
    logger.info(' - to do so, click "manage portlets" in the relevant folder.')

    members = getattr(portal, 'Members', None)
    if members is not None:
        membersRightSlots = getattr(aq_base(members), 'right_slots', None)
        if membersRightSlots == []:
            rightColumn = getUtility(
                IPortletManager, name=u'plone.rightcolumn', context=portal)
            portletAssignments = getMultiAdapter(
                (members, rightColumn,), ILocalPortletAssignmentManager)
            portletAssignments.setBlacklistStatus(CONTEXT_PORTLETS, True)
            logger.info(
                'Blacklisted contextual portlets in the Members folder')
Exemple #2
0
def convertLegacyPortlets(context):
    """Convert portlets defined in left_slots and right_slots at the portal
    root to use plone.portlets. Also block portlets in the Members folder.

    Note - there may be other portlets defined elsewhere. These will require
    manual upgrade from the @@manage-portlets view. This is to avoid a
    full walk of the portal (i.e. waking up every single object) looking for
    potential left_slots/right_slots!
    """
    portal = getToolByName(context, 'portal_url').getPortalObject()
    convert_legacy_portlets(portal)
    logger.info('Converted legacy portlets at the portal root')
    logger.info('NOTE: You may need to convert other portlets manually.')
    logger.info(' - to do so, click "manage portlets" in the relevant folder.')

    members = getattr(portal, 'Members', None)
    if members is not None:
        membersRightSlots = getattr(aq_base(members), 'right_slots', None)
        if membersRightSlots == []:
            rightColumn = getUtility(IPortletManager,
                                     name=u'plone.rightcolumn',
                                     context=portal)
            portletAssignments = getMultiAdapter((
                members,
                rightColumn,
            ), ILocalPortletAssignmentManager)
            portletAssignments.setBlacklistStatus(CONTEXT_PORTLETS, True)
            logger.info(
                'Blacklisted contextual portlets in the Members folder')
 def convert_legacy_portlets(self):
     utils.convert_legacy_portlets(self.context)
     self.request.response.redirect(self.context.absolute_url() + '/@@manage-portlets')
Exemple #4
0
 def convert_legacy_portlets(self):
     utils.convert_legacy_portlets(self.context)
     self.request.response.redirect(self.context.absolute_url() +
                                    '/@@manage-portlets')