def migrateWGs(portal):
    """Migrate Workgroup to ATWorkgroup; largely stolen from ATCT.migration.atctmigrator"""
    LOG.debug('Starting ATWorkspace type migration')
    kwargs = {}

    atct = getToolByName(portal, 'portal_atct')
    kwargs['use_catalog_patch'] = bool(atct.migration_catalog_patch)
    kwargs['transaction_size'] = int(atct.migration_transaction_size)
    transaction = atct.migration_transaction_style
    if transaction == "full transaction":
        kwargs['full_transaction'] = True
        kwargs['use_savepoint'] = False
    elif transaction == "savepoint":
        kwargs['full_transaction'] = False
        kwargs['use_savepoint'] = True
    else:
        kwargs['full_transaction'] = False
        kwargs['use_savepoint'] = False

    out = StringIO()
    migrator = WorkgroupMigrator
    ## a loop in original...
    src_portal_type = migrator.src_portal_type
    dst_portal_type = migrator.dst_portal_type
    ttool = getToolByName(portal, 'portal_types')
    if (ttool.getTypeInfo(src_portal_type) is None
            or ttool.getTypeInfo(dst_portal_type) is None):

        LOG.debug('Missing FTI for %s or %s' %
                  (src_portal_type, dst_portal_type))
        print >> out, ("Couldn't migrate src_portal_type due to missing FTI")
        #continue
    else:
        migratePortalType(portal,
                          src_portal_type,
                          dst_portal_type,
                          out=out,
                          migrator=migrator,
                          **kwargs)
    ##

    LOG.debug('Finished ATWorkgroup type migration')

    return out.getvalue()
Exemplo n.º 2
0
    def migrateCMFMemberType(portal, out):
        """Run the actual migration."""

        src_portal_type = klass._atct_newTypeFor['portal_type']
        dst_portal_type = klass.portal_type

        # store the workflow(s) associated w/ the old type so we can
        # associate the new one when we're done
        wftool = getToolByName(portal, 'portal_workflow')
        chain = wftool.getChainForPortalType(src_portal_type)

        # portal_quickinstaller won't work before the membrane_tool is
        # in place because some remember fields are indexed in the
        # membrane_tool but it isn't installed before migration.  So
        # we use Archetypes to install the type here.
        ttool = getToolByName(portal, 'portal_types')
        dst = ttool.getTypeInfo(dst_portal_type)
        if dst is None:
            print >> out, ("...installing %s type"
                           % dst_portal_type)
            at_type = getType(klass.meta_type, project_name)
            types = filterTypes(portal, out, [at_type], project_name)
            install_types(portal, out, types, project_name)

        mt = getToolByName(portal, 'membrane_tool')
        if dst_portal_type not in mt.listMembraneTypes():
            print >> out, ("...registering %s with membrane_tool"
                           % dst_portal_type)
            mt.registerMembraneType(dst_portal_type)

        print >> out, "...migrating %s to %s" % (src_portal_type,
                                                 dst_portal_type)
        migratePortalType(portal,
                          src_portal_type=src_portal_type,
                          dst_portal_type=dst_portal_type,
                          migrator=migrator,
                          use_catalog_patch=False)

        # associate the appropriate workflow
        wftool.setChainForPortalTypes((dst_portal_type,),
                                      chain)
Exemplo n.º 3
0
    def migrateCMFMemberType(portal, out):
        """Run the actual migration."""

        src_portal_type = klass._atct_newTypeFor['portal_type']
        dst_portal_type = klass.portal_type

        # store the workflow(s) associated w/ the old type so we can
        # associate the new one when we're done
        wftool = getToolByName(portal, 'portal_workflow')
        chain = wftool.getChainForPortalType(src_portal_type)

        # portal_quickinstaller won't work before the membrane_tool is
        # in place because some remember fields are indexed in the
        # membrane_tool but it isn't installed before migration.  So
        # we use Archetypes to install the type here.
        ttool = getToolByName(portal, 'portal_types')
        dst = ttool.getTypeInfo(dst_portal_type)
        if dst is None:
            print >> out, ("...installing %s type" % dst_portal_type)
            at_type = getType(klass.meta_type, project_name)
            types = filterTypes(portal, out, [at_type], project_name)
            install_types(portal, out, types, project_name)

        mt = getToolByName(portal, 'membrane_tool')
        if dst_portal_type not in mt.listMembraneTypes():
            print >> out, ("...registering %s with membrane_tool" %
                           dst_portal_type)
            mt.registerMembraneType(dst_portal_type)

        print >> out, "...migrating %s to %s" % (src_portal_type,
                                                 dst_portal_type)
        migratePortalType(portal,
                          src_portal_type=src_portal_type,
                          dst_portal_type=dst_portal_type,
                          migrator=migrator,
                          use_catalog_patch=False)

        # associate the appropriate workflow
        wftool.setChainForPortalTypes((dst_portal_type, ), chain)
def migrateWGs(portal):
    """Migrate Workgroup to ATWorkgroup; largely stolen from ATCT.migration.atctmigrator"""
    LOG.debug("Starting ATWorkspace type migration")
    kwargs = {}

    atct = getToolByName(portal, "portal_atct")
    kwargs["use_catalog_patch"] = bool(atct.migration_catalog_patch)
    kwargs["transaction_size"] = int(atct.migration_transaction_size)
    transaction = atct.migration_transaction_style
    if transaction == "full transaction":
        kwargs["full_transaction"] = True
        kwargs["use_savepoint"] = False
    elif transaction == "savepoint":
        kwargs["full_transaction"] = False
        kwargs["use_savepoint"] = True
    else:
        kwargs["full_transaction"] = False
        kwargs["use_savepoint"] = False

    out = StringIO()
    migrator = WorkgroupMigrator
    ## a loop in original...
    src_portal_type = migrator.src_portal_type
    dst_portal_type = migrator.dst_portal_type
    ttool = getToolByName(portal, "portal_types")
    if ttool.getTypeInfo(src_portal_type) is None or ttool.getTypeInfo(dst_portal_type) is None:

        LOG.debug("Missing FTI for %s or %s" % (src_portal_type, dst_portal_type))
        print >> out, ("Couldn't migrate src_portal_type due to missing FTI")
        # continue
    else:
        migratePortalType(portal, src_portal_type, dst_portal_type, out=out, migrator=migrator, **kwargs)
    ##

    LOG.debug("Finished ATWorkgroup type migration")

    return out.getvalue()