我几乎成功地将 ZODB 的摘录(文件夹的一小部分,包括从其他文件夹中获取的资源)转移到另一个 Plone 实例;最重要的是:在导入期间,我的对象没有被写入。这是我的导出脚本:
[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
基于默认的导出和导入脚本 from 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
据我了解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
当 对constructor
不做任何事情时item
,我会计算原因;显然该constructor
部分没有写任何东西,因为它不知道要创建的对象的类型。但是这些信息不应该是在某个地方创建的吗?!
(还有另一个问题:显然fileimporter
714 只接收 31 个对象,datacorrector
但首先我想看看导入的任何东西。)
我究竟做错了什么?
哦,在线文档collective.transmogrifier.sections
会很好;他们甚至缺少文档字符串......
编辑:我的启用计数的叉子在这里(分支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
因此,collector
仍然找不到_type
信息。
第三次编辑:
我添加了一个小工具,它打印有关找到的项目的简短信息(默认情况下,每个部分的第一个项目;_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)
事实上,任何地方都没有_type
钥匙,所以我需要一个提供它们的部分。
第四次编辑:
重新插入manifestimporter
before 后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
这些manifestimporter
部分不转发任何以前的项目,因此所有项目reader
都被丢弃。
第 5 次编辑: 尝试了使用“站点配置导出步骤”的推荐方式;我编辑了默认导出脚本并尝试了导出,但我得到了以下回溯:
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>)
uidexporter
我的部分是否包括在内并不重要。
第六次编辑:
这是我用于站点配置导出步骤的当前导出配置文件:
[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
第 7 次编辑:
简短信息需要哪种数据才能reader
创建constructor
对象,以及导出管道的哪个部分(了解必要选项)可能轻松获得 150 点声望点 ;-)