예제 #1
0
파일: catalog.py 프로젝트: goschtl/zope
def importCatalogTool(context):
    """Import catalog tool.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ICatalogTool)

    importObjects(tool, '', context)
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
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
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)
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
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
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
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
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
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
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
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
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)
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)