Esempio n. 1
0
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 8
0
def importCatalogTool(context, name='portal_catalog'):
    """Import catalog.
    """
    site = context.getSite()
    tool = getToolByName(site, name, None)
    if tool is not None:
        importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 12
0
def importCookieCrumbler(context):
    """Import cookie crumbler settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ICookieCrumbler)

    importObjects(tool, '', context)
Esempio n. 13
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)
Esempio n. 14
0
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)
Esempio n. 16
0
def importCatalogTool(context):
    """Import catalog tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_catalog')

    importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 18
0
def importGlossaryTool(context):
    """Import glossary tool settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, PLONEGLOSSARY_TOOL)

    importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 20
0
def importActionProviders(context):
    """Import actions tool.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_actions')

    importObjects(tool, '', context)
Esempio n. 21
0
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_types')

    importObjects(tool, '', context)
Esempio n. 22
0
def importMailHost(context):
    """Import mailhost settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'MailHost')

    importObjects(tool, '', context)
Esempio n. 23
0
def importFactoryTool(context):
    """Import Factory Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_factory')

    importObjects(tool, '', context)
Esempio n. 24
0
def importATCTTool(context):
    """Import ATCT Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_atct')

    importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 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)
Esempio n. 27
0
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_types')

    importObjects(tool, '', context)
Esempio n. 28
0
def importTypesTool(context):
    """Import types tool and content types from XML files.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(ITypesTool)

    importObjects(tool, '', context)
Esempio n. 29
0
def importActionProviders(context):
    """Import actions tool.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(IActionsTool)

    importObjects(tool, '', context)
Esempio n. 30
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)
Esempio n. 31
0
def importCookieCrumbler(context):
    """Import cookie crumbler settings from an XML file.
    """
    site = context.getSite()
    tool = getToolByName(site, 'cookie_authentication')

    importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 33
0
def importMimetypes(context):
    """Import mimetypes registry.
    """
    site = context.getSite()
    tool = getToolByName(site, 'mimetypes_registry')

    importObjects(tool, '', context)
Esempio n. 34
0
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)
Esempio n. 35
0
def importMailHost(context):
    """Import mailhost settings from an XML file.
    """
    sm = getSiteManager(context.getSite())
    tool = sm.getUtility(IMailHost)

    importObjects(tool, '', context)
def importATCTTool(context):
    """Import ATCT Tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'portal_atct', None)

    if tool is not None:
        importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 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)
Esempio n. 39
0
def importMembraneTool(context):
    """
    Import membrane_tool configuration.
    """
    site = context.getSite()
    tool = getToolByName(site, 'membrane_tool')

    importObjects(tool, '', context)
def importTinyMCESettings(context):
    """Import TinyMCE Settings"""
    site = context.getSite()
    tool = getToolByName(site, 'portal_tinymce', None)
    if tool is None:
        return

    importObjects(tool, '', context)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 49
0
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 56
0
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)
Esempio n. 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)
Esempio n. 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)