Importing and exporting Plone folders using quintagroup.transmogrify

0. Exporting single folder only

Here is explained how to export and import Plone CMS folders between different Plonen versions, or different CMS systems, using XML based content marshalling and quintagroup.transmogrifier.

This overcomes some problems with Zope management based export/import which uses Python pickles and thus needs identical codebase on the source and target site. Exporting and importing between Plone 3 and Plone 4 is possible.

You can limit export to cover source content to with arbitary portal_catalog conditions. If you limit source content by path you can effectively export single folder only.

The recipe described here assumes the exported and imported site have the same path for the folder. Manually rename or move the folder on source or target to change its location.

Note: The instructions here requires quintagroup.transmogrify version 0.4 or later … or trunk version during the writing of this blog post.

1) Source site

Execute these actions on the source Plone site.

Install quintagroup.transmogrifier via buildout and Plone add-on control panel.

Go to Site setup > Content migration.

Edit export settings. Remove unnecessary pipeline entries by looking the example below. Add a new catalogsource blueprin. The exclude-contained option makes sure we do not export unnecessary items from the parent folderst:

.

[transmogrifier]
pipeline =
    catalogsource
    fileexporter
    marshaller
    datacorrector
    writer
    EXPORTING

[catalogsource]
blueprint = quintagroup.transmogrifier.catalogsource
path = query= /isleofback/ohjeet
exclude-contained = true

Also we need to include some field-level exluding bits for the folders, because the target site does not necessary have the same content types available as the source site and this may prevent setting up folderish content settings:

[marshaller]
blueprint = quintagroup.transmogrifier.marshaller
exclude =
  immediatelyAddableTypes
  locallyAllowedTypes

You might want to remove other, unneeded blueprints from the export pipeline. For example, portletexporter may cause problems if the source and target site do not have the same portlet code.

Go to Zope Management Interface > portal_setup > Export tab. Check Content (transmogrifier) step. Press Export Selected Steps at the bottom of the page. Now a .tar.gz file will be downloaded.

During the export process instance.log file is updated with status info. You might want to follow it in real-time from UNIX command line

tail -f var/log/instance.log

In log you should see entries running like:

2010-12-27 12:05:30 INFO EXPORTING _path=sisalto/ohjeet/yritys/yritysten-tuotetiedot/tuotekortti
2010-12-27 12:05:30 INFO EXPORTING
Pipeline processing time: 00:00:02
          94 items were generated in source sections
          94 went through full pipeline
           0 were discarded in some section

2) Target site

Execute these actions on the target Plone site.

Install quintagroup.transmogrifier via buildout and Plone add-on control panel.

Open target site instance.log file for monitoring the import process

tail -f var/log/instance.log

Go to Zope Management Interface > portal_setup > Import tab.

Choose downloaded setup_toolxxx.tar.gz file at the bottom of the page, for Import uploaded tarball input.

Run import and monitoring log file for possible errors. Note that the import completes even if the target site would not able to process incoming content. If there is a serious problem the import seems to complete succesfully, but no content is created.

Note: Currently export/import is not perfect. For example, ZMI content type icons are currently lost in the process. It is recommended to do a test run on a staging server before doing this process on a production server. Also, the item order in the folder is being lost.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

8 thoughts on “Importing and exporting Plone folders using quintagroup.transmogrify

  1. You write that “Exporting and importing between Plone 3 and Plone 4 is possible.” How about from an 2.5 instance to 4? We have a site running on 2.5 which we want to upgrade. Since there is a strong need to restructure the whole site, we plan to build a new one from scratch. This transmogrifier seems to be a good alternative to copy/paste when it comes to moving content from the old to the new site…

  2. Hi Arve,

    Plone 2.5 begins to show its old age and new shiny solutions the community builds rarely supports Plone 2.5 anymore.

    We have been migrating Plone 2.x sites to Plone 3.x by writing our own ad-hoc import and export scripts which dump Plone site and its custom content as files. Then we read those files at the other end of the system.

    If you do not have Python developers the most recommended approach would be creating a copy of 2.5 site, upgrading the copy to P4 and then export related content bits from copied site to a new, empty, site.

  3. Upgrading our site has been long due, and we’re looking forward to the day when we again have the opportunity to utilize all the exciting products and tweaks that the community is working on. It will be a huge job upgrading, given the gap between the versions, but it will be worth it. Thanks for your reply!

  4. Hi,
    I have been trying to create a new Plone 4.0.4 site with the content and appearance of an existing plone 4.0.4 site.

    So when I am trying to export the content (transmigrifier) then I am getting the following error massage.

    Traceback (innermost last):
    Module ZPublisher.Publish, line 127, in publish
    Module ZPublisher.mapply, line 77, in mapply
    Module ZPublisher.Publish, line 47, in call_object
    Module Products.GenericSetup.tool, line 575, in manage_exportSelectedSteps
    Module Products.GenericSetup.tool, line 1022, in _doRunExportSteps
    Module quintagroup.transmogrifier.exportimport, line 89, in exportSiteStructure
    Module quintagroup.transmogrifier.logger, line 30, in __iter__
    Module quintagroup.transmogrifier.writer, line 47, in __iter__
    Module quintagroup.transmogrifier.datacorrector, line 36, in __iter__
    Module quintagroup.transmogrifier.marshall, line 36, in __iter__
    Module quintagroup.transmogrifier.binary, line 54, in __iter__
    Module quintagroup.transmogrifier.binary, line 87, in extractFile
    AttributeError: getBaseUnit

    Can anyone please tell me what is going wrong?

  5. Anjoom: you probably have broken content items on your site. Solving the problem would need advanced Python pdb debugging in the quitagroup Python code to inspect the content item triggering the problem.

  6. Thank you for your quick reply.
    Can you give me any other suggestion to create a new Plone 4.0.4 site from an existing Plone 4.0.4 site? I also need the data of the current site. So actually I need to make a backup site.

    Do you have any tips?

  7. 1- ¿and simply copy paste instance? first.
    2- between same instances, import export default zexp format should be ok.
    This for copy.
    Anoter question is backup sistems: a) copy paste. b) -more used ¿?- save Data.fs file etc etc.
    For mi transmogrifier is last option.
    Regards

Leave a Reply

Your email address will not be published. Required fields are marked *