基于Products.contentmigration的内容迁移向导
项目描述
简介
由 Giacomo Spettoli <giacomo.spettoli@gmail.com> 和 Regione Emilia-Romagna
该产品是基于框架Products.contentmigration的内容迁移的用户界面。
向导将指导网站管理员通过3个步骤进行迁移:
从列表中选择所需的迁移
从过滤的站点图中选择应用迁移的内容
确认迁移。
此产品还提供了一种注册新迁移的简单方法。在“allmigration”文件夹中您可以找到一些示例。这里展示的是folderToLargeFolder迁移。
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
为了创建您自己的迁移,您必须创建一个扩展ATFolderMigrator或ATItemMigrator的类
from Products.contentmigration.archetypes import ATFolderMigrator,ATItemMigrator
此新类必须实现IContentMigrator接口
implements(IContentMigrator)
接下来,您需要插入源和目标portal_type和meta_type(您可以在zmi/portal_types中找到这些值)
src_meta_type = "ATFolder" src_portal_type = "Folder" dst_meta_type = "ATBTreeFolder" dst_portal_type = "Large Plone Folder"
您可以设置迁移为“安全”或“不安全”。一个“安全”的迁移是指目标内容类型与原始内容类型具有相等或更多的字段。您还可以在描述中插入一个警告信息
safeMigration = True description = "Document to Document"
然后,在__init__方法中,您必须在目标字段中映射源字段。基本archetypes字段已经在BASE_AT_PROPERTIES中映射
self.fields_map = BASE_AT_PROPERTIES
- 最后,插入此行以创建一个命名工具:
<类名>Migrator = <类名>
在zcml文件中注册新工具
<utility component=".basemigrations.FolderToLargePloneFolderMigrator" provides="..interfaces.IContentMigrator" name="collective.contentmigrationui.FolderToLargePloneFolderMigrator" />
变更日志
0.1
初始发布
项目详情
关闭
集体内容迁移ui-0.1-py2.4.egg的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d3e239e841cff097d7e825c34bc8b44951812663afe7527731f559142bc8e89b |
|
MD5 | 4b3b0183b51acc7e6d7cc3ea0741abfd |
|
BLAKE2b-256 | f3e176da27b1ef6f74b01b51b37e99679c31164bc642fcfa81611694f516e8be |