eggification
[MosaicDocument.git] / Products / MosaicDocument / exportimport / mosaictool.py
diff --git a/Products/MosaicDocument/exportimport/mosaictool.py b/Products/MosaicDocument/exportimport/mosaictool.py
new file mode 100644 (file)
index 0000000..a0a55e1
--- /dev/null
@@ -0,0 +1,22 @@
+from Products.CMFCore.utils import getToolByName
+from Products.GenericSetup.utils import importObjects, exportObjects
+
+def importMosaicTool(context):
+    """Import mosaic tool and content types from XML files.
+    """
+    site = context.getSite()
+    tool = getToolByName(site, 'mosaic_tool')
+       
+    importObjects(tool, 'mosaic_tool/', context)
+
+def exportMosaicTool(context):
+    """Export mosaic tool content types as a set of XML files.
+    """
+    site = context.getSite()
+    tool = getToolByName(site, 'mosaic_tool', None)
+    if tool is None:
+        logger = context.getLogger('mosaictool')
+        logger.info('Nothing to export.')
+        return
+
+    exportObjects(tool, 'mosaic_tool/', context)
\ No newline at end of file