示例#1
0
def runTypesMigration(setuptool):
    """
        Migrate to 3+ types
    """
    
    runTypesUpdate(setuptool)
    
    portal = getPortal()
    
    # add next/previous flags to multi-page types
    print migrateNextPrev(portal)
    # move body texts
    print migrateBodyTexts(portal)
    print migrateFAQs(portal)

    # real type migration: convert manual and
    # tutorial pages to the new, generic leaf
    # content type.
    out = StringIO()
    for migrator in (RMPageMigrator, TPageMigrator):
        walker = migrator.walkerClass(portal, migrator)
        walker.go(out=out)
        print out
        print walker.getOutput()

    # object_provides catalog entries need updating
    reindexNearlyAll(setuptool)

    return
def migrate(portal, migrators=(ResidentialMigrator, CommercialMigrator)):
    """Run the migration

    `migrators` is settable for the benefit of testing.

    """
    out = StringIO()
    logger.info("Starting realestatebroker migration.")
    print >> out, "Starting migration"
    for migrator in migrators:
        walker = migrator.walkerClass(portal, migrator)
        walker.go(out=out)
        print >> out, walker.getOutput()
    print >> out, "Migration finished"
    return out.getvalue()