Back to index

plone3  3.1.7
catalog.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """Catalog tool setup handlers.
00014 
00015 $Id: catalog.py 77004 2007-06-24 08:57:54Z yuppie $
00016 """
00017 
00018 from Products.GenericSetup.utils import exportObjects
00019 from Products.GenericSetup.utils import importObjects
00020 
00021 from Products.CMFCore.utils import getToolByName
00022 
00023 
00024 def importCatalogTool(context):
00025     """Import catalog tool.
00026     """
00027     site = context.getSite()
00028     tool = getToolByName(site, 'portal_catalog')
00029 
00030     importObjects(tool, '', context)
00031 
00032 def exportCatalogTool(context):
00033     """Export catalog tool.
00034     """
00035     site = context.getSite()
00036     tool = getToolByName(site, 'portal_catalog', None)
00037     if tool is None:
00038         logger = context.getLogger('catalog')
00039         logger.info('Nothing to export.')
00040         return
00041 
00042     exportObjects(tool, '', context)