one of our customer wants to migrate the content of one of its Plone sites using a script that needs to get content based on location and tags, move that content to a new location and apply some new tags to it.
at first I was planning to use plone.importexport but after reading the requirements I decided that it would be better to write a custom script that could be using plone.restapi.
I read part of plone.importexport code and seems relatively easy to write such script, and my plan would be something like this:
make a catalog call to get the content tagged on the location specified
transform objects into a json string using the ISerializeToJson adapter
clean up the resulting JSON by removing the attributes that are not useful
recursively do the same thing on any object inside folderish content (mainly images and files), b64encoding their data
add information about possible alias of the content
creating a ZIP file containing all objects serialized in JSON format
on the importing part I would
read the ZIP file to get all serialized data
create the objects in the new location (or in the old location and move them after that) (I don't know if this can be done using also plone.restapi using the IDeserializeFromJson adapter)
create the associated aliases including a new one referencing the old location
recursively create all contained objects by b64decoding their data
I want to ask if anybody has done this before and if there is something I need to be aware.
To do this sort of things, in the past we have used collective.jsonify to export the contents from the old site and use collective.transmogrifier to import it in the new site.
@erral thank you, very much, for your help! today I was able to do a full export and import of almost 200 Dexterity-based content objects among 2 different versions of the project I'm working on, and everything seems to be working as expected.
the working transmogrifier pipline can be seen here:
I have now a couple of doubts: I need to change one of the content types default view during the migration; is there a pipeline section that can help me on that task?
the other problem seems to be a little bit more complicated: the collective.cover content type is being migrated except for the tiles configuration because they are stored in annotations in the object:
@hvelarde Was working on plone.importexport at the sprint on the weekend. It would be good to know what could be added to make it fit your needs.
Seems like adding a search criteria during export is the only thing thats missing. The changes of path and tags you'd have to do anyway using excel or csv script.
Anything else required for this specific usecase to work well?
BTW I also considered if a search criteria widget for the import dialog might also make sense. ie it would only replace content included in the search result and drop everything else. Not sure how useful that would be.
I think the goal of the add-on is different from what we need and that has been the story since the beginning. our use case is simple: migrate a Plone site from an older version to a new one.
plone.importexport seem to be oriented to a different audience; we, as integrators, feel easier to migrate site using Transmogrifier.
I think support for the jsonify format would be a nice to have. Possibly as an external script rather than as part of plone.importexport. We recently had to write a script to create a CSV of some of the jsonify data just to make it more usable for an export to another system. A similar script could turn an on disk jsonify dump into a format compatible with plone.importexport @hvelarde ? possibly even a transmogrify blueprint to output a p.importexport compatible format.