Plone: colle.transmogrifier.sections.constructor не записывает объекты при импорте
Я почти преуспел в своих усилиях по переносу выдержки из моего ZODB (небольшого подмножества папок, включая ресурсы, взятые из других папок) в другой экземпляр Plone; showtopper: во время импорта мои объекты не пишутся. Вот мой скрипт экспорта:
[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
На основе сценариев экспорта и импорта по умолчанию из 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
получает только 31 объект из 714, переданных datacorrector
, Но сначала я бы хотел увидеть что-нибудь импортированное.)
Что я делаю неправильно?
Да, и онлайн-документация для collective.transmogrifier.sections
было бы хорошо, у них даже нет строк документации...
Изменить: мои вилки с подсчетом здесь (филиалы add-info
):
- https://github.com/tobiasherp/collective.transmogrifier
- https://github.com/tobiasherp/plone.app.transmogrifier
- https://github.com/tobiasherp/quintagroup.transmogrifier
2-е редактирование:
Когда я двигаю 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
Информация.
3-е редактирование:
Я добавил небольшое средство, которое печатает краткую информацию о найденных предметах (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)
Действительно нет _type
ключи где угодно, поэтому мне нужен раздел, который предоставляет их.
4-е редактирование:
После повторной вставки 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
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
раздел был включен.
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
Седьмое редактирование: краткая информация о том, какие данные требуются reader
чтобы включить constructor
создавать объекты, и какой участок конвейера экспорта (с идеей о необходимых опциях) может легко заработать 150 очков репутации;-)
1 ответ
Из сравнения с quintagroup.transmogrifier's import.cfg В вашем конвейере отсутствует раздел манифестатора. Их конвейер гласит:
pipeline =
reader
manifestimporter
constructor
datacorrector
fileimporter
demarshaller
referencesimporter
propertiesimporter
commentsimporter
portletsimporter
IMPORTING