Example #1
0
def cleanPortalProperties(context):
    """Removed unused portal properties"""
    ptool = getToolByName(context, 'portal_properties')
    props = ptool.site_properties
    if props.hasProperty('displayLastModifierInByline'):
        logger.info('Removing unused portal_properties and set new roles')
        props.manage_delProperties(ids=['displayLastModifierInByline'])
Example #2
0
def install(portal):
    # keep this until we want to support Plone < 4.2
    setup_tool = portal.portal_setup
    setup_tool.runAllImportStepsFromProfile('profile-rt.lastmodifier:default')
    if QS:
        setup_tool.runAllImportStepsFromProfile('profile-rt.lastmodifier:new-collection')
    logger.info("Installed")
Example #3
0
def uninstall(portal, reinstall=False):
    if not reinstall:
        # Don't want to delete stuff on reinstall
        setup_tool = portal.portal_setup
        setup_tool.runAllImportStepsFromProfile('profile-rt.lastmodifier:uninstall')
        if QS:
            setup_tool.runAllImportStepsFromProfile('profile-rt.lastmodifier:new-collection-uninstall')
        _removeProperty(portal)
        logger.info("Uninstalled")
def addKeyToCatalog(portal):
    '''Takes portal_catalog and adds a key to it
    @param portal: context providing portal_catalog
    '''

    catalog = getToolByName(portal, 'portal_catalog')
    indexes = catalog.indexes()
    # Specify the indexes you want, with ('index_name', 'index_type')

    indexables = []

    WANTED_INDEXES = (('Modifier', 'FieldIndex'),)

    for name, meta_type in WANTED_INDEXES:
        if name not in indexes:
            catalog.addIndex(name, meta_type)
            indexables.append(name)
            logger.info("Added %s for field %s.", meta_type, name)
    if len(indexables) > 0:
        logger.info("Indexing new index: %s.", ', '.join(indexables))
        catalog.manage_reindexIndex(ids=indexables)
Example #5
0
def to_1100(context):
    context.runAllImportStepsFromProfile('profile-rt.lastmodifier:to_1100')
    logger.info('Upgraded to version 0.4')
Example #6
0
def to_1010(context):
    context.runImportStepFromProfile(default_profile, 'rolemap')
    cleanPortalProperties(context)
    logger.info('Upgraded to version 0.3.1')
def migrateTo1110(context):
    setup_tool = getToolByName(context, 'portal_setup')
    setup_tool.runAllImportStepsFromProfile('profile-rt.lastmodifier:to_1110')
    logger.info('New permission registered')
    logger.info('Migrated to version 0.7')
Example #8
0
def _removeProperty(portal):
    try:
        portal.portal_properties.site_properties.manage_delProperties(['displayLastModifierInByline'])
        logger.info("Removed property displayLastModifierInByline")
    except BadRequest:
        pass