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)