Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A content migration wizard based on Products.contentmigration

Project Description

Introduction

by Giacomo Spettoli<giacomo.spettoli@gmail.com> and Regione Emilia-Romagna

This product is a user interface for migrate content based on framework Products.contentmigration.

The wizard will guide the site administrator with 3 step:

  1. select the desired migration from a list
  2. select in which contents apply the migration from a filtered site map
  3. confirm the migration.

This product also provide an easy way to register new migration. In “allmigration” folder you can find some example. Here the folderToLargeFolder migration:

class FolderToLargePloneFolder(object, ATFolderMigrator):
    """Migrate the old item type to the new item type
    """
    implements(IContentMigrator)

    walker = CustomQueryWalker
    src_meta_type = "ATFolder"
    src_portal_type = "Folder"
    dst_meta_type = "ATBTreeFolder"
    dst_portal_type = "Large Plone Folder"
    description = "Document to Document"
    safeMigration = True

    def __init__(self, *args, **kwargs):
        ATFolderMigrator.__init__(self, *args, **kwargs)
        self.fields_map = BASE_AT_PROPERTIES

FolderToLargePloneFolderMigrator = FolderToLargePloneFolder

In order to create your own migration you must create a class that extend ATFolderMigrator or ATItemMigrator:

from Products.contentmigration.archetypes import ATFolderMigrator,ATItemMigrator

This new class must implements IContentMigrator interface:

implements(IContentMigrator)

Next you insert source and destination portal_type and meta_type (you can find these values in zmi/portal_types):

src_meta_type = "ATFolder"
src_portal_type = "Folder"
dst_meta_type = "ATBTreeFolder"
dst_portal_type = "Large Plone Folder"

You can set the migration as “safe” or “unsafe”. A “safe” migration is a migration where the destination content type has equal/more fields than origin content type. You can also insert a warning message in description:

safeMigration = True
description = "Document to Document"

And than,in the __init__ method you must map source fields in destination fields. Basic archetypes fields are already mapped in BASE_AT_PROPERTIES:

self.fields_map = BASE_AT_PROPERTIES
At last insert this line to create a named utility::
<class name>Migrator = <class name>

In a zcml file register the new utility:

<utility
    component=".basemigrations.FolderToLargePloneFolderMigrator"
    provides="..interfaces.IContentMigrator"
    name="collective.contentmigrationui.FolderToLargePloneFolderMigrator"
/>

Changelog

0.1

  • Initial release
Release History

Release History

This version
History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.contentmigrationui-0.1-py2.4.egg (52.1 kB) Copy SHA256 Checksum SHA256 2.4 Egg Aug 19, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting