Back to index

plone3  3.1.7
exportimport.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 """Filesystem exporter / importer adapters.
00014 
00015 $Id: exportimport.py 40142 2005-11-15 21:10:43Z tseaver $
00016 """
00017 
00018 from zope.interface import implements
00019 from Products.GenericSetup.interfaces import IContentFactory
00020 from Products.GenericSetup.interfaces import IContentFactoryName
00021 from Products.GenericSetup.interfaces import IFilesystemExporter
00022 from Products.GenericSetup.interfaces import IFilesystemImporter
00023 from Products.GenericSetup.utils import _getDottedName
00024 
00025 #
00026 #   setup_tool handlers
00027 #
00028 def exportPAS(context):
00029     IFilesystemExporter(context.getSite()).export(context, 'PAS', True)
00030 
00031 def importPAS(context):
00032     IFilesystemImporter(context.getSite()).import_(context, 'PAS', True)
00033 
00034 
00035 class PAS_PR_ContentFactory(object):
00036 
00037     implements(IContentFactory)
00038 
00039     def __init__(self, context):
00040         self.context = context
00041 
00042     def __call__(self, object_id):
00043         from Products.PluginRegistry.PluginRegistry import PluginRegistry
00044         registry = PluginRegistry(())
00045         registry._setId(object_id)
00046         self.context._setObject(object_id, registry)
00047         return registry
00048     
00049 class PAS_CF_Namer(object):
00050 
00051     implements(IContentFactoryName)
00052 
00053     def __init__(self, context):
00054         self.context = context
00055 
00056     def __call__(self):
00057         return 'plugins'