def migrateTo1003(context):
    setup_tool = getToolByName(context, 'portal_setup')
    if setup_tool.getBaselineContextID() == 'profile-redturtle.smartlink:default' or \
            setup_tool.getBaselineContextID() == 'profile-redturtle.smartlink:uninstall':
        setup_tool.setBaselineContext('profile-Products.CMFPlone:plone')
        logger.info("Restoring the proper base line context for Generic Setup")
    logger.info("Migrated to 1.1.3")
Beispiel #2
0
def migrateTo1003(context):
    setup_tool = getToolByName(context, 'portal_setup')
    if setup_tool.getBaselineContextID() == 'profile-redturtle.smartlink:default' or \
            setup_tool.getBaselineContextID() == 'profile-redturtle.smartlink:uninstall':
        setup_tool.setBaselineContext('profile-Products.CMFPlone:plone')
        logger.info("Restoring the proper base line context for Generic Setup")
    logger.info("Migrated to 1.1.3")
def unregisterIcon(portal):
    """Remove icon expression from Link type"""
    portal_types = portal.portal_types
    link = portal_types.getTypeInfo("Link")
    # link.icon_expr = ''
    link.content_icon = ""
    link.manage_changeProperties(content_icon="", icon_expr="")
    logger.info("Removing icon type info")
Beispiel #4
0
def unregisterIcon(portal):
    """Remove icon expression from Link type"""
    portal_types = portal.portal_types
    link = portal_types.getTypeInfo("Link")
    #link.icon_expr = ''
    link.content_icon = ''
    link.manage_changeProperties(content_icon='', icon_expr='')
    logger.info("Removing icon type info")
Beispiel #5
0
def migrateTo1210(context):
    _REMOVE_IMPORT_STEPS = [
        'imaged-event',
    ]
    registry = context.getImportStepRegistry()
    remove = _REMOVE_IMPORT_STEPS
    for step in remove:
        if step in registry._registered:
            registry.unregisterStep(step)
            logger.info("Removing import_step %s" % step)
    logger.info("Migrated to 1.2.1")
def migrateTo1210(context):
    _REMOVE_IMPORT_STEPS = [
        'imaged-event',
    ]
    registry = context.getImportStepRegistry()
    remove = _REMOVE_IMPORT_STEPS
    for step in remove:
        if step in registry._registered:
            registry.unregisterStep(step)
            logger.info("Removing import_step %s" % step)
    logger.info("Migrated to 1.2.1")
def removeSmartLinkMarks(portal):
    """Remove all Smart Link marker interfaces all around the site"""
    catalog = portal.portal_catalog
    smartlinkeds = catalog(object_provides=ISmartLinked.__identifier__)

    logger.info("Uninstall Smart Link: removing flag to internally linked contents...")
    for linked in smartlinkeds:
        content = linked.getObject()
        # Bee lazy, so use the already developed procedure for the delete-events
        unLink(portal, content)
        interface.noLongerProvides(content, ISmartLinked)
        content.reindexObject(["object_provides"])
        logger.info("   unmarked %s" % "/".join(content.getPhysicalPath()))
def uninstall(portal, reinstall=False):
    setup_tool = portal.portal_setup
    setup_tool.runAllImportStepsFromProfile("profile-redturtle.smartlink:uninstall")
    if getFSVersionTuple()[0] >= 4:
        unregisterIcon(portal)
    if not reinstall:
        removeSmartLinkMarks(portal)
        setup_tool.runAllImportStepsFromProfile("profile-redturtle.smartlink:smartLinkToATLink")
        logger.info("...done. Thanks you for using me!")
        portal.plone_utils.addPortalMessage(
            _("uninstall_info", default=u"All of yours Smart Link contents has been transformed back to Plone ATLink"),
            type="info",
        )
Beispiel #9
0
def removeSmartLinkMarks(portal):
    """Remove all Smart Link marker interfaces all around the site"""
    catalog = portal.portal_catalog
    smartlinkeds = catalog(object_provides=ISmartLinked.__identifier__)

    logger.info(
        "Uninstall Smart Link: removing flag to internally linked contents...")
    for linked in smartlinkeds:
        content = linked.getObject()
        # Bee lazy, so use the already developed procedure for the delete-events
        unLink(portal, content)
        interface.noLongerProvides(content, ISmartLinked)
        content.reindexObject(['object_provides'])
        logger.info("   unmarked %s" % '/'.join(content.getPhysicalPath()))
Beispiel #10
0
def uninstall(portal, reinstall=False):
    setup_tool = portal.portal_setup
    setup_tool.runAllImportStepsFromProfile(
        'profile-redturtle.smartlink:uninstall')
    if getFSVersionTuple()[0] >= 4:
        unregisterIcon(portal)
    if not reinstall:
        removeSmartLinkMarks(portal)
        setup_tool.runAllImportStepsFromProfile(
            'profile-redturtle.smartlink:smartLinkToATLink')
        logger.info("...done. Thanks you for using me!")
        portal.plone_utils.addPortalMessage(_(
            'uninstall_info',
            default=
            u'All of yours Smart Link contents has been transformed back to Plone ATLink'
        ),
                                            type='info')
Beispiel #11
0
def smartLinkToATLink(context):
    """Run this to recover original Plone ATLink"""
    portal = context.getSite()

    if context.readDataFile(
            'redturtle.smartlink_smartLinkToATLink.txt') is None:
        return

    try:
        from redturtle.smartlink.migrator import migrateSmartLinkToLink
        logger.info("Starting migration of Smart Link back to ATLink")
        messages = migrateSmartLinkToLink(portal)
        i = 0
        for m in messages:
            i += 1
            logger.info(m)
            portal.plone_utils.addPortalMessage(m, type="warning")
        portal.plone_utils.addPortalMessage(
            _('sequence_help_message',
              default=u"$num element(s) migrated",
              mapping={'num': i}))
        logger.info("Done")

    except ImportError:
        logger.error(
            "Can't do anything. Check if Products.contentmigration is installed"
        )
def atLinkToSmartLink(context):
    portal = context.getSite()

    if context.readDataFile('redturtle.smartlink_linkToSmartLink.txt') is None:
        return
    
    try:
        from redturtle.smartlink.migrator import migrateLinkToSmartLink
        logger.info("Starting migration of ATLink to Smart Link")
        messages = migrateLinkToSmartLink(portal)
        i = 0
        for m in messages:
            i+=1
            logger.info(m)
            portal.plone_utils.addPortalMessage(m, type="warning")
        portal.plone_utils.addPortalMessage(_('sequence_help_message',
                                              default=u"$num element(s) migrated",
                                              mapping={'num': i}))
        logger.info("Done")

    except ImportError:
        logger.error("Can't do anything. Check if Products.contentmigration is installed")
Beispiel #13
0
def migrateTo1002(context):
    setup_tool = getToolByName(context, 'portal_setup')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'rolemap')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'controlpanel')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'action-icons')
    logger.info("Migrated to 1.1.0")
def migrateTo1002(context):
    setup_tool = getToolByName(context, 'portal_setup')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'rolemap')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'controlpanel')
    setup_tool.runImportStepFromProfile(PROFILE_ID, 'action-icons')
    logger.info("Migrated to 1.1.0")