<< ALL BLOG POSTS

Using Plone’s .zexp Export/Import for Debugging

Table of Contents

It’s best practice to debug or develop against the same content that is in production, but what should you do if there’s a limited amount of space to work with and the full production data can’t be pulled down? You can use Zope’s export/import. 

The export/import process is most helpful when a client reports a bug within a particular section of the site. With this feature, the developer can export the section, load the content locally and debug it without “breaking” the production site. Plone docs also recommend using this process as a way to test that an add-on has been cleanly removed.

Because you can’t select multiple folders at a level to export them together, the exports should be done one folder at a time. When importing, the folder doesn’t need to be imported at the same location - it can be put anywhere in the local instance. After importing, don’t forget to update the catalog if it should be aware of the new content.

An important note: the sites that content is being exported and imported between need to be identical. If the local instance is on a different version of Plone, or missing add-ons that are in production, the file won’t be able to be imported. Six Feet Up uses buildout to manage the install across multiple instances and keep it consistent, but other tools such as Docker work for this as well.

Step-by-step process

  1. Find the folder you want to export in the ZMI. If it’s down a few levels in the structure, you will see a screen similar to the one below. To go down a level, select the folder and click the “Edit” button. When you find the item you want to export, select it and click the “Import/Export” button.
4sUqDqHg.png
  1. On the Export/Import screen, you will see this window at the top. Select your export location and click the “Export” button. I usually download it to my local machine
4LV8Cs0w.png

  1. Put the downloaded .zexp into your local buildout’s var/instance/import folder. If you have multiple instances, you only need to add it to one (and then connect to that one for importing).
Q8GIyFuw.png
  1. In your local site’s ZMI, navigate to the place where you want to import the item. The path does not need to match where the item was in the original site. Click the “Import/Export” button. At the bottom of the page is the Import section. A dropdown shows you all .zexp files in your import folder. Select the one you want to import, and click the “Import” button.
RKBK1h9A.png
  1. The content will now be available in your local instance. If you need the content in the catalog, remember to update it - portal_catalog> Advanced tab > “Update Catalog” button. (A “Clear and Rebuild” may also be necessary.)
Related Posts
How can we assist you?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.