コード例 #1
0
ファイル: catalog.py プロジェクト: goschtl/zope
def importCatalogTool(context):
    """Import catalog tool.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ICatalogTool)

    importObjects(tool, '', context)
コード例 #2
0
def importCompositeTool(context):
    """ Import composite tool properties.
    """
    site = context.getSite()
    logger = context.getLogger('composite tool properties')
    tool = getToolByName(site, 'composite_tool', None)

    if tool is None:
        logger.info('Composite tool: No tool present.')
        return

    body = context.readDataFile('composite_tool.xml')
    if body is None:
        body = context.readDataFile('compositetool.xml')
        if body is None:
            logger.info('Composite tool: Nothing to import.')
            return
        logger.info('Composite tool: deprecation warning, please rename your profile to composite_tool.xml.')

    importer = queryMultiAdapter((tool, context), IBody)
    if importer is None:
        logger.warning('Composite tool: Import adapter misssing.')
        return

    importer.body = body
    importObjects(tool, '', context)
コード例 #3
0
def importCachingPolicyManager(context):
    """Import caching policy manager settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'caching_policy_manager')

    importObjects(tool, '', context)
コード例 #4
0
def importContentTypeRegistry(context):
    """Import content type registry settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'content_type_registry')

    importObjects(tool, '', context)
コード例 #5
0
def importWorkflowTool(context):
    """Import workflow tool and contained workflow definitions from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_workflow')

    importObjects(tool, '', context)
コード例 #6
0
def importSkinsTool(context):
    """Import skins tool FSDirViews and skin paths from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_skins')

    importObjects(tool, '', context)
コード例 #7
0
def importWorkflowPolicies(context):
    """Import workflow policies from the XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_placeful_workflow', None)
    if tool is not None:
        importObjects(tool, '', context)
コード例 #8
0
ファイル: catalog.py プロジェクト: CGTIC/Plone_SP
def importCatalogTool(context, name='portal_catalog'):
    """Import catalog.
    """
    site = context.getSite()
    tool = getToolByName(site, name, None)
    if tool is not None:
        importObjects(tool, '', context)
コード例 #9
0
ファイル: contenttyperegistry.py プロジェクト: goschtl/zope
def importContentTypeRegistry(context):
    """Import content type registry settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(IContentTypeRegistry)

    importObjects(tool, '', context)
コード例 #10
0
def installTypeIfNeeded(type_name):
    """Make sure the dexterity-fti is already installed.
    If not we create a empty dexterity fti and load the
    information from the fti in the profile.
    """
    if type_name not in DEFAULT_TYPES:
        raise KeyError('{0} is not one of the default types'.format(type_name))
    portal = getSite()
    tt = getToolByName(portal, 'portal_types')
    fti = tt.getTypeInfo(type_name)
    if IDexterityFTI.providedBy(fti):
        # The dx-type is already installed, so keep it.  But this
        # might be an old dexterity type of Collection, in which case
        # it is better to replace it.
        if type_name != 'Collection':
            return
        if fti.klass == 'plone.app.contenttypes.content.Collection':
            # If the klass is fine, we are happy.
            return
    if fti:
        tt.manage_delObjects(type_name)
    tt.manage_addTypeInformation('Dexterity FTI', id=type_name)
    dx_fti = tt.getTypeInfo(type_name)
    ps = getToolByName(portal, 'portal_setup')
    profile_info = ps.getProfileInfo('profile-plone.app.contenttypes:default')
    profile_path = os.path.join(profile_info['path'])
    environ = DirectoryImportContext(ps, profile_path)
    parent_path = 'types/'
    importObjects(dx_fti, parent_path, environ)
コード例 #11
0
ファイル: cachingpolicymgr.py プロジェクト: goschtl/zope
def importCachingPolicyManager(context):
    """Import caching policy manager settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ICachingPolicyManager)

    importObjects(tool, '', context)
コード例 #12
0
ファイル: cookieauth.py プロジェクト: goschtl/zope
def importCookieCrumbler(context):
    """Import cookie crumbler settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ICookieCrumbler)

    importObjects(tool, '', context)
コード例 #13
0
ファイル: skins.py プロジェクト: goschtl/zope
def importSkinsTool(context):
    """Import skins tool FSDirViews and skin paths from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_skins')

    importObjects(tool, '', context)
コード例 #14
0
ファイル: controlpanel.py プロジェクト: dtgit/dtedu
def importControlPanel(context):
    """Import Plone control panel.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_controlpanel')

    importObjects(tool, '', context)
コード例 #15
0
def importCatalogTool(context):
    """Import catalog tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'research_database_catalog', None)
    if tool is not None:
        importObjects(tool, '', context)
コード例 #16
0
ファイル: catalog.py プロジェクト: goschtl/zope
def importCatalogTool(context):
    """Import catalog tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_catalog')

    importObjects(tool, '', context)
コード例 #17
0
ファイル: contenttyperegistry.py プロジェクト: goschtl/zope
def importContentTypeRegistry(context):
    """Import content type registry settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'content_type_registry')

    importObjects(tool, '', context)
コード例 #18
0
def importGlossaryTool(context):
    """Import glossary tool settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, PLONEGLOSSARY_TOOL)

    importObjects(tool, '', context)
コード例 #19
0
ファイル: cachingpolicymgr.py プロジェクト: goschtl/zope
def importCachingPolicyManager(context):
    """Import caching policy manager settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'caching_policy_manager')

    importObjects(tool, '', context)
コード例 #20
0
ファイル: actions.py プロジェクト: goschtl/zope
def importActionProviders(context):
    """Import actions tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_actions')

    importObjects(tool, '', context)
コード例 #21
0
ファイル: typeinfo.py プロジェクト: bendavis78/zope
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_types')

    importObjects(tool, '', context)
コード例 #22
0
def importMailHost(context):
    """Import mailhost settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'MailHost')

    importObjects(tool, '', context)
コード例 #23
0
ファイル: factorytool.py プロジェクト: dtgit/dtedu
def importFactoryTool(context):
    """Import Factory Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_factory')

    importObjects(tool, '', context)
コード例 #24
0
ファイル: atcttool.py プロジェクト: dtgit/dtedu
def importATCTTool(context):
    """Import ATCT Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_atct')

    importObjects(tool, '', context)
コード例 #25
0
ファイル: exportimport.py プロジェクト: CGTIC/Plone_SP
def importLanguageTool(context):
    """Import Plone language tool settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_languages')

    importObjects(tool, '', context)
コード例 #26
0
ファイル: workflow_policies.py プロジェクト: CGTIC/Plone_SP
def importWorkflowPolicies(context):
    """Import workflow policies from the XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_placeful_workflow', None)
    if tool is not None:
        importObjects(tool, '', context)
コード例 #27
0
ファイル: typeinfo.py プロジェクト: goschtl/zope
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_types')

    importObjects(tool, '', context)
コード例 #28
0
ファイル: typeinfo.py プロジェクト: goschtl/zope
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ITypesTool)

    importObjects(tool, '', context)
コード例 #29
0
ファイル: actions.py プロジェクト: goschtl/zope
def importActionProviders(context):
    """Import actions tool.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(IActionsTool)

    importObjects(tool, '', context)
コード例 #30
0
ファイル: workflow.py プロジェクト: goschtl/zope
def importWorkflowTool(context):
    """Import workflow tool and contained workflow definitions from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_workflow')

    importObjects(tool, '', context)
コード例 #31
0
ファイル: cookieauth.py プロジェクト: goschtl/zope
def importCookieCrumbler(context):
    """Import cookie crumbler settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'cookie_authentication')

    importObjects(tool, '', context)
コード例 #32
0
def installTypeIfNeeded(type_name):
    """Make sure the dexterity-fti is already installed.
    If not we create a empty dexterity fti and load the
    information from the fti in the profile.
    """
    if type_name not in DEFAULT_TYPES:
        raise KeyError('{0} is not one of the default types'.format(type_name))
    portal = getSite()
    tt = getToolByName(portal, 'portal_types')
    fti = tt.getTypeInfo(type_name)
    if IDexterityFTI.providedBy(fti):
        # The dx-type is already installed, so keep it.  But this
        # might be an old dexterity type of Collection, in which case
        # it is better to replace it.
        if type_name != 'Collection':
            return
        if fti.klass == 'plone.app.contenttypes.content.Collection':
            # If the klass is fine, we are happy.
            return
    if fti:
        tt.manage_delObjects(type_name)
    tt.manage_addTypeInformation('Dexterity FTI', id=type_name)
    dx_fti = tt.getTypeInfo(type_name)
    ps = getToolByName(portal, 'portal_setup')
    profile_info = ps.getProfileInfo('profile-plone.app.contenttypes:default')
    profile_path = os.path.join(profile_info['path'])
    environ = DirectoryImportContext(ps, profile_path)
    parent_path = 'types/'
    importObjects(dx_fti, parent_path, environ)
コード例 #33
0
ファイル: handler.py プロジェクト: hoka/collective.mtrsetup
def importMimetypes(context):
    """Import mimetypes registry.
    """
    site = context.getSite()
    tool = getToolByName(site, 'mimetypes_registry')

    importObjects(tool, '', context)
コード例 #34
0
ファイル: skins.py プロジェクト: goschtl/zope
def importSkinsTool(context):
    """Import skins tool FSDirViews and skin paths from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ISkinsTool)

    importObjects(tool, '', context)
コード例 #35
0
ファイル: mailhost.py プロジェクト: dtgit/dtedu
def importMailHost(context):
    """Import mailhost settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(IMailHost)

    importObjects(tool, '', context)
コード例 #36
0
def importATCTTool(context):
    """Import ATCT Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_atct', None)

    if tool is not None:
        importObjects(tool, '', context)
コード例 #37
0
def importDiffTool(context):
    """Import Factory Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_diff', None)

    if tool is not None:
        importObjects(tool, '', context)
コード例 #38
0
def importPrimoSettings(context):
    """Import Primo Settings"""
    site = context.getSite()
    tool = getToolByName(site, 'portal_primo', None)
    if tool is None:
        return

    importObjects(tool, '', context)
コード例 #39
0
ファイル: membranetool.py プロジェクト: a25kk/stv2
def importMembraneTool(context):
    """
    Import membrane_tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'membrane_tool')

    importObjects(tool, '', context)
コード例 #40
0
def importTinyMCESettings(context):
    """Import TinyMCE Settings"""
    site = context.getSite()
    tool = getToolByName(site, 'portal_tinymce', None)
    if tool is None:
        return

    importObjects(tool, '', context)
コード例 #41
0
def importControlPanel(context):
    """Import Plone control panel.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_controlpanel', None)
    if tool is None:
        return

    importObjects(tool, '', context)
コード例 #42
0
def importMembraneTool(context):
    """
    Import membrane_tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'membrane_tool', None)

    if tool is not None:
        importObjects(tool, '', context)
コード例 #43
0
def importFactoryTool(context):
    """Import Factory Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_factory', None)
    if tool is None:
        return

    importObjects(tool, '', context)
コード例 #44
0
ファイル: exportimport.py プロジェクト: biodec/plone4bio.base
def importSettings(context):
    """Import tool settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'plone4bio_predictors', None)
    if tool:
        importObjects(tool, '', context)
    tool = getToolByName(site, 'plone4bio_dbxrefpatterns', None)
    if tool:
        importObjects(tool, '', context)
コード例 #45
0
def importSolrSettings(context):
    """ import settings for solr integration from an XML file """
    site = context.getSite()
    utility = queryUtility(ISolrConnectionConfig, context=site)
    if utility is None:
        logger = context.getLogger('collective.solr')
        logger.info('Nothing to import.')
        return
    if IPersistent.providedBy(utility):
        importObjects(utility, '', context)
コード例 #46
0
def importLemonLDAPPropertiesSettings(context):
    container = plone.api.portal.get()
    uf = getattr(aq_base(container), 'acl_users', None)

    if uf is not None:
        lemonLdapId = 'lemonldap'
        if lemonLdapId not in uf.objectIds():
            manage_addLemonLDAPManager(uf, lemonLdapId)
        shibproperties = getattr(uf, lemonLdapId)
        importObjects(shibproperties, '', context)
コード例 #47
0
def importAnalyticsReports(context):
    """
    Import Analytics tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_analytics', None)
    if tool is None:
        return

    importObjects(tool, '', context)
コード例 #48
0
ファイル: workflow.py プロジェクト: wlang42/Products.CMFCore
def importWorkflowTool(context):
    """Import workflow tool and contained workflow definitions from XML files.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(IWorkflowTool)
    if tool is None:
        logger = context.getLogger('workflow')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #49
0
ファイル: actions.py プロジェクト: c0ns0le/zenoss-4
def importActionProviders(context):
    """Import actions tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_actions', None)
    if tool is None:
        logger = context.getLogger('actions')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #50
0
def importRepositoryTool(context):
    """Import Repository Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_repository', None)
    if tool is None:
        logger = context.getLogger("repositorytool")
        logger.info("Nothing to import.")
        return

    importObjects(tool, '', context)
コード例 #51
0
def importCatalogTool(context):
    """Import catalog tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_catalog', None)
    if tool is None:
        logger = context.getLogger('catalog')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #52
0
def importCookieCrumbler(context):
    """Import cookie crumbler settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(ICookieCrumbler)
    if tool is None:
        logger = context.getLogger('cookies')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #53
0
def importMemberDataTool(context):
    """Import member data tool settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(IMemberDataTool)
    if tool is None:
        logger = context.getLogger('memberdata')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #54
0
ファイル: skins.py プロジェクト: plone-ve/Products.CMFCore
def importSkinsTool(context):
    """Import skins tool FSDirViews and skin paths from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(ISkinsTool)
    if tool is None:
        logger = context.getLogger('skins')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #55
0
def importCatalogTool(context):
    """Import catalog tool.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(ICatalogTool)
    if tool is None:
        logger = context.getLogger('catalog')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #56
0
ファイル: skins.py プロジェクト: bendavis78/zope
def importSkinsTool(context):
    """Import skins tool FSDirViews and skin paths from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_skins', None)
    if tool is None:
        logger = context.getLogger('skins')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #57
0
def importContentTypeRegistry(context):
    """Import content type registry settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(IContentTypeRegistry)
    if tool is None:
        logger = context.getLogger('contenttypes')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #58
0
def importMailHost(context):
    """Import mailhost settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(IMailHost)
    if tool is None:
        logger = context.getLogger('mailhost')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)
コード例 #59
0
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.queryUtility(ITypesTool)
    if tool is None:
        logger = context.getLogger('types')
        logger.debug('Nothing to import.')
        return

    importObjects(tool, '', context)