Tob*_*ias 8 data-migration plone transmogrifier plone-4.x
我几乎成功地将我的ZODB(一小部分文件夹,包括从其他文件夹中获取的资源)的摘录转移到另一个Plone实例; showstopper是:在导入期间,我的对象不会被写入.这是我的导出脚本:
[transmogrifier]
pipeline =
sitewalker
xmlwalker
uidextractor
encapsulator
manifestexporter
fileexporter
marshaller
propertiesexporter
commentsexporter
datacorrector
portletsexporter
writer
EXPORTING
[sitewalker]
blueprint = quintagroup.transmogrifier.sitewalker
path =
folder1
folder2
[xmlwalker]
blueprint = collective.transmogrifier.sections.xmlwalker
[uidextractor]
# my own section which parses the html text of the given fields,
# checks the href and src attributes for UIDs, and injects entries
# for the refered objects into the pipeline
blueprint = my.transmogrifier.uidextractor
inspect_fields =
text
description
notes
[encapsulator]
blueprint = plone.app.transmogrifier.mimeencapsulator
mimetype = item/_mimetype
field = string:datafield
[manifestexporter]
blueprint = quintagroup.transmogrifier.manifestexporter
[fileexporter]
blueprint = quintagroup.transmogrifier.fileexporter
[marshaller]
blueprint = quintagroup.transmogrifier.marshaller
[propertiesexporter]
blueprint = quintagroup.transmogrifier.propertiesexporter
[commentsexporter]
blueprint = quintagroup.transmogrifier.commentsexporter
[datacorrector]
blueprint = quintagroup.transmogrifier.datacorrector
sources =
marshall
[portletsexporter]
blueprint = quintagroup.transmogrifier.portletsexporter
[writer]
blueprint = quintagroup.transmogrifier.writer
context = directory
path = var/export/
prefix = structure
[EXPORTING]
blueprint = quintagroup.transmogrifier.logger
keys =
_type
_path
Run Code Online (Sandbox Code Playgroud)
根据默认的导出和导入脚本quintagroup.transmogrifier,这是我的导入脚本:
[transmogrifier]
pipeline =
reader
pathfixer
constructor
schemaupdater
datacorrector
demarshaller
uidupdater
referencesimporter
propertiesimporter
commentsimporter
portletsimporter
printcounters
IMPORTING
[reader]
blueprint = quintagroup.transmogrifier.reader
prefix =
path = /path/to/var/export
context = directory
# unchanged entries I don't really understand:
.objects.xml = manifest
.marshall.xml = marshall
.properties.xml = propertymanager
.comments.xml = comments
.file-fields.xml = file-fields
.interfaces.xml = interfaces
.portlets.xml = portlets
[pathfixer]
blueprint = plone.app.transmogrifier.pathfixer
stripstring = Plone/
prependstring =
[constructor]
blueprint = collective.transmogrifier.sections.constructor
[schemaupdater]
blueprint = plone.app.transmogrifier.atschemaupdater
[datacorrector]
blueprint = quintagroup.transmogrifier.datacorrector
type = import
sources =
marshall
[fileimporter]
blueprint = quintagroup.transmogrifier.fileimporter
[demarshaller]
blueprint = quintagroup.transmogrifier.demarshaller
[uidupdater]
blueprint = plone.app.transmogrifier.uidupdater
[referencesimporter]
blueprint = quintagroup.transmogrifier.referencesimporter
[propertiesimporter]
blueprint = quintagroup.transmogrifier.propertiesimporter
[commentsimporter]
blueprint = quintagroup.transmogrifier.commentsimporter
[portletsimporter]
blueprint = quintagroup.transmogrifier.portletsimporter
[printcounters]
blueprint = collective.transmogrifier.sections.summary
count = true
[IMPORTING]
blueprint = quintagroup.transmogrifier.logger
keys =
_type
_path
Run Code Online (Sandbox Code Playgroud)
据我所知,reader出现了writer; 在marshaller出现了demarshaller,等等.然而,在导入的对象实际上并没有写入到数据库.使用计数工具调整蓝图(在add-info我的包的
分支中),我得到以下概述:
Items summary
~~~~~~~~~~~~~
[reader]:
created: 714
[pathfixer]:
got: 714
forwarded: 714
stripped: 390
[constructor]:
got: 714
missing-type: 714
missing-info: 714
forwarded: 714
[datacorrector]:
got: 714
forwarded: 714
[fileimporter]:
got: 31
forwarded: 31
[demarshaller]:
got: 31
forwarded: 31
[uidupdater]:
got: 31
forwarded: 31
[referencesimporter]:
passed-through: 31
[printcounters]:
passed-through: 31
[IMPORTING]:
got: 31
forwarded: 31
Run Code Online (Sandbox Code Playgroud)
当constructor对此没有任何意义时item,我会计算原因; 显然该constructor部分没有写任何东西,因为它不知道要创建的对象的类型.但是不应该在某个地方创建这些信息吗?!
(还有一个问题:显然fileimporter只接收了714传递的31个对象datacorrector.但首先我想看看任何导入的东西.)
我究竟做错了什么?
哦,在线文档collective.transmogrifier.sections会很好;他们甚至缺乏docstrings ...
编辑:我的启用计数的分叉在这里(分支机构add-info):
第二编辑:
当我移动IMPORTING之前的部分时constructer,计数器输出是:
Items summary
~~~~~~~~~~~~~
[reader]:
created: 714
[pathfixer]:
got: 714
forwarded: 714
stripped: 390
[IMPORTING]:
got: 714
forwarded: 714
[constructor]:
got: 714
missing-type: 714
missing-info: 714
forwarded: 714
[datacorrector]:
got: 714
forwarded: 714
[fileimporter]:
got: 31
forwarded: 31
[demarshaller]:
got: 31
forwarded: 31
[uidupdater]:
got: 31
forwarded: 31
[referencesimporter]:
passed-through: 31
[printcounters]:
passed-through: 31
Run Code Online (Sandbox Code Playgroud)
因此,collector仍然找不到_type信息.
第三编辑:
我添加了一个小工具,打印一个关于找到的项目的简短信息(默认情况下每个部分的第1项; _path以及_type值,如果存在,以及其他键的列表).结果是:
[reader], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #2:
_path=''
other keys: _import_context (DirectoryImportContext)
2015-08-18 18:39:56 INFO IMPORTING _path=
[constructor], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[reader], item #2:
_path='some/archetypes/object/containing/a/video'
other keys: _files (dict), _import_context (DirectoryImportContext)
Run Code Online (Sandbox Code Playgroud)
确实在任何_type地方都没有钥匙,所以我需要一个提供它们的部分.
第四编辑:
重新插入manifestimporter之后constructor,我得到了:
[reader], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #2:
_path=''
other keys: _import_context (DirectoryImportContext)
2015-08-19 10:15:43 INFO IMPORTING _path=
[constructor], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[manifestimporter], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[reader], item #2:
_path=' [reader], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[pathfixer], item #2:
_path=''
other keys: _import_context (DirectoryImportContext)
2015-08-19 10:15:43 INFO IMPORTING _path=
[constructor], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[manifestimporter], item #1:
_path=''
other keys: _import_context (DirectoryImportContext)
[reader], item #2:
_path='some/archetypes/object/containing/a/video'
other keys: _files (dict), _import_context (DirectoryImportContext)
...
2015-08-19 10:15:44 INFO IMPORTING
Pipeline processing time: 00:00:00
715 items were generated in source sections
2 went through full pipeline
713 were discarded in some section
Run Code Online (Sandbox Code Playgroud)
这些manifestimporter部分不会转发任何以前的项目,因此所有项目都会reader被丢弃.
5th Edit: 尝试使用"站点配置导出步骤" 的推荐方法 我编辑了默认的导出脚本并尝试了导出,但是我得到了以下回溯:
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 598, in manage_exportSelectedSteps
Module Products.GenericSetup.tool, line 1053, in _doRunExportSteps
Module quintagroup.transmogrifier.exportimport, line 74, in exportSiteStructure
Module collective.transmogrifier.utils, line 121, in constructPipeline
Module quintagroup.transmogrifier.sitewalker, line 29, in __init__
TypeError: ('Could not adapt', {'manifestexporter': {'blueprint': 'quintagroup.transmogrifier.manifestexporter'}, 'transmogrifier': {'pipeline': '\nsitewalker\nuidextractor\npathfixer\nmanifestexporter\nfileexporter\nmarshaller\npropertiesexporter\ncommentsexporter\ndatacorrector\nportletsexporter\nwriter\nEXPORTING'}, 'uidextractor': {'blueprint': 'my.transmogrifier.uidextractor', 'trace-first': 'true', 'inspect_fields': '\ntext\ndescription\nnotes'}, 'sitewalker': {'blueprint': 'quintagroup.transmogrifier.sitewalker', 'start-path': '\nakademie/vortraege/d-02-verlegung-lektion-02-leitungsgraben', 'exclude-contained': 'false'}, 'xmlwalker': {'blueprint': 'collective.transmogrifier.sections.xmlwalker'}, 'encapsulator': {'blueprint': 'plone.app.transmogrifier.mimeencapsulator', 'mimetype': 'item/_mimetype', 'field': 'string:datafield'}, 'writer': {'blueprint': 'quintagroup.transmogrifier.writer', 'path': 'var/export/', 'prefix': '', 'context': 'tarball'}, 'commentsexporter': {'blueprint': 'quintagroup.transmogrifier.commentsexporter'}, 'pathfixer': {'blueprint': 'plone.app.transmogrifier.pathfixer', 'stripstring': 'unitracc/'}, 'echo': {'blueprint': 'visaplan.transmogrifier.echo'}, 'marshaller': {'blueprint': 'quintagroup.transmogrifier.marshaller'}, 'propertiesexporter': {'blueprint': 'quintagroup.transmogrifier.propertiesexporter'}, 'datacorrector': {'blueprint': 'quintagroup.transmogrifier.datacorrector', 'sources': '\nmarshall'}, 'breakpoint': {'blueprint': 'collective.transmogrifier.sections.breakpoint'}, 'EXPORTING': {'blueprint': 'quintagroup.transmogrifier.logger', 'keys': '\n_type\n_path'}, 'portletsexporter': {'blueprint': 'quintagroup.transmogrifier.portletsexporter'}, 'fileexporter': {'blueprint': 'quintagroup.transmogrifier.fileexporter'}}, <InterfaceClass zope.annotation.interfaces.IAnnotations>)
Run Code Online (Sandbox Code Playgroud)
是否uidexporter包括我的部分并不重要.
第6编辑:
以下是我用于站点配置导出步骤的当前导出配置文件:
[transmogrifier]
pipeline =
sitewalker
manifestexporter
fileexporter
marshaller
propertiesexporter
commentsexporter
datacorrector
portletsexporter
writer
EXPORTING
[sitewalker]
blueprint = quintagroup.transmogrifier.sitewalker
exclude-contained = false
start-path =
Plone/some/existing/structure
[manifestexporter]
blueprint = quintagroup.transmogrifier.manifestexporter
[fileexporter]
blueprint = quintagroup.transmogrifier.fileexporter
[marshaller]
blueprint = quintagroup.transmogrifier.marshaller
[propertiesexporter]
blueprint = quintagroup.transmogrifier.propertiesexporter
[commentsexporter]
blueprint = quintagroup.transmogrifier.commentsexporter
[datacorrector]
blueprint = quintagroup.transmogrifier.datacorrector
sources =
marshall
[portletsexporter]
blueprint = quintagroup.transmogrifier.portletsexporter
[writer]
blueprint = quintagroup.transmogrifier.writer
context = tarball
path = var/export/
prefix =
[EXPORTING]
blueprint = quintagroup.transmogrifier.logger
keys =
_type
_path
Run Code Online (Sandbox Code Playgroud)
第7编辑:
一个简短的信息,reader使得constructor创建对象需要哪种数据,以及导出管道的哪一部分(了解必要的选项)可以获得150点声望点;-)
与quintagroup.transmogrifier 的 import.cfg进行比较,您的管道中缺少 manifestimporter 部分。他们的管道如下:
pipeline =
reader
manifestimporter
constructor
datacorrector
fileimporter
demarshaller
referencesimporter
propertiesimporter
commentsimporter
portletsimporter
IMPORTING
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
228 次 |
| 最近记录: |