当前位置: 首页>>代码示例>>Python>>正文


Python SetupMultilingualSite.setupSite方法代码示例

本文整理汇总了Python中plone.app.multilingual.browser.setup.SetupMultilingualSite.setupSite方法的典型用法代码示例。如果您正苦于以下问题:Python SetupMultilingualSite.setupSite方法的具体用法?Python SetupMultilingualSite.setupSite怎么用?Python SetupMultilingualSite.setupSite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plone.app.multilingual.browser.setup.SetupMultilingualSite的用法示例。


在下文中一共展示了SetupMultilingualSite.setupSite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupLanguage

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
def setupLanguage(context):
    logger("Creating language-dependent content")
    l = context.getSite()
    lu = getToolByName(l, 'portal_languages')
    setupTool = SetupMultilingualSite()
    data = (
        (
            "en",
            u"Rudd-O.com in English",
            u"Linux, free software, voluntaryism and cypherpunk.  Established 1999.",
        ),
        (
            "es",
            u"Rudd-O.com en español",
            u"Linux, software libre, voluntarismo y cypherpunk.  Desde 1999.",
        ),
    )
    for code, title, desc in data:
        if code not in [x[0] for x in lu.listSupportedLanguages()]:
            logger("Adding support for language code %s", code)
            lu.addSupportedLanguage(code)
            setupTool.setupSite(l)
            setupTool.setupLanguageSwitcher()
    for code, title, desc in data:
        l[code].setTitle(title)
        l[code].setDescription(desc)
    logger("Language-dependent content created")
开发者ID:Rudd-O,项目名称:Rudd-O.com,代码行数:29,代码来源:setupHandlers.py

示例2: init_content

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
def init_content(context):
    portal = api.portal.get()
    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)
    setupTool.move_default_language_content()
    for lang in ['fr', 'en', 'it']:
        create_cover(portal[lang])
开发者ID:makinacorpus,项目名称:phenology.plone,代码行数:9,代码来源:upgrades.py

示例3: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
def setUp():
    portal = getSite()
    applyProfile(portal, 'plone.multilingualbehavior:default')

    language_tool = getToolByName(portal, 'portal_languages')
    language_tool.addSupportedLanguage('ca')
    language_tool.addSupportedLanguage('es')

    workflowTool = getToolByName(portal, "portal_workflow")
    workflowTool.setDefaultChain('simple_publication_workflow')

    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)

    transaction.commit()

    atdoc = makeContent(portal['en'], 'Document', id='atdoc', title='EN doc')
    atdoc.setLanguage('en')
    atdoc_ca = makeTranslation(atdoc, 'ca')
    atdoc_ca.edit(title="CA doc", language='ca')

    dxdoc = createContentInContainer(portal['en'], "dxdoc", id="dxdoc", title='EN doc')
    ILanguage(dxdoc).set_language('en')
    dxdoc_ca = makeTranslation(dxdoc, 'ca')
    dxdoc_ca.title = "CA doc"
    ILanguage(dxdoc_ca).set_language('ca')

    transaction.commit()
开发者ID:savoirfairelinux,项目名称:plone.app.multilingual,代码行数:30,代码来源:test_robot.py

示例4: setUpPAMFolders

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
 def setUpPAMFolders(self):
     workflowTool = getToolByName(self.portal, "portal_workflow")
     workflowTool.setDefaultChain('simple_publication_workflow')
     setupTool = SetupMultilingualSite()
     setupTool.setupSite(self.portal)
     transaction.commit()
     return workflowTool
开发者ID:khink,项目名称:plone.app.multilingual,代码行数:9,代码来源:test_selector.py

示例5: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        self.portal = self.layer['portal']

        # Setup multilingual site
        language_tool = getToolByName(self.portal, 'portal_languages')
        language_tool.addSupportedLanguage('it')
        language_tool.addSupportedLanguage('de')
        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)

        # Setup test browser
        self.browser = Browser(self.layer['app'])
        self.browser.handleErrors = False
        self.browser.addHeader(
            'Authorization', 'Basic %s:%s' % (
                SITE_OWNER_NAME, SITE_OWNER_PASSWORD))

        # Create sample document in 'en' and index it into catalog
        self.container = self.portal['en']
        self.content_id = self.container.invokeFactory(
            type_name="Document", id="sampledocument-form")
        self.content = self.container[self.content_id]
        self.content.setLanguage('en')
        notify(ObjectAddedEvent(self.content))

        import transaction
        transaction.commit()
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:29,代码来源:test_form.py

示例6: post_install

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
def post_install(setup):
    """Post install script"""
    if setup.readDataFile('plonedemosite_default.txt') is None:
        return
    portal = api.portal.get()
    remove_content(portal)
    create_demo_users()
    languages = api.portal.get_registry_record('plone.available_languages')
    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)
    for language in languages:
        container = portal[language]

        # Create frontpage for language
        frontpage = create_frontpage(
            portal, container=container, target_language=language)
        container.setDefaultPage('frontpage')
        ILanguage(frontpage).set_language(language)

        # Link the new frontpage as a translation to all existing items
        for lang in languages:
            existing_frontpage = portal[lang].get('frontpage')
            if existing_frontpage:
                ITranslationManager(existing_frontpage).register_translation(
                    language, frontpage)

        # Import zexp for language
        import_zexp(
            setup,
            filename='demo_%s.zexp' % language,
            container=container,
            name='demo',
            update=True,
            publish=True,
        )
开发者ID:uabaroholka2016,项目名称:demo.plone.de,代码行数:37,代码来源:setuphandlers.py

示例7: setUpPloneSite

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
 def setUpPloneSite(self, portal):
     applyProfile(portal, 'plone.app.multilingual:default')
     setRoles(portal, TEST_USER_ID, ['Manager'])
     login(portal, TEST_USER_NAME)
     language_tool = getToolByName(portal, 'portal_languages')
     language_tool.addSupportedLanguage('fr')
     language_tool.addSupportedLanguage('it')
     setup_tool = SetupMultilingualSite()
     setup_tool.setupSite(portal)
开发者ID:plone,项目名称:plone.app.users,代码行数:11,代码来源:test_pam.py

示例8: setupMultilingual

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
def setupMultilingual(context):
    if context.readDataFile('osha.hwccontent.txt') is None:
        return
    portal = context.getSite()

    setupTool = SetupMultilingualSite()
    setupTool.setupSite(portal)

    setupTool.setupSharedFolder()
开发者ID:EU-OSHA,项目名称:osha.hwccontent,代码行数:11,代码来源:setuphandlers.py

示例9: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, 'portal_languages')
            language_tool.addSupportedLanguage('ca')
            language_tool.addSupportedLanguage('es')

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
开发者ID:martior,项目名称:plone.app.multilingual,代码行数:12,代码来源:testing.py

示例10: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        self.portal = self.layer['portal']
        self.portal.error_log._ignored_exceptions = ()
        self.request = self.layer['request']
        self.portal_url = self.portal.absolute_url()
        self.language_tool = getToolByName(self.portal, 'portal_languages')
        self.language_tool.addSupportedLanguage('ca')
        self.language_tool.addSupportedLanguage('es')

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:13,代码来源:test_alternates.py

示例11: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     self.language_tool = getToolByName(self.portal, 'portal_languages')
     self.language_tool.addSupportedLanguage('ca')
     self.language_tool.addSupportedLanguage('es')
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     login(self.portal, TEST_USER_NAME)
     workflowTool = getToolByName(self.portal, "portal_workflow")
     workflowTool.setDefaultChain('simple_publication_workflow')
     setupTool = SetupMultilingualSite()
     setupTool.setupSite(self.portal)
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:14,代码来源:test_helper_views.py

示例12: test_add_all_supported_languages

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def test_add_all_supported_languages(self):
        """ There was a language which code is 'id'
            and it broke the root language folder setup process
        """
        language_tool = getToolByName(self.portal, 'portal_languages')
        for lang in AllContentLanguageVocabulary()(self.portal):
            language_tool.addSupportedLanguage(lang.value)

        workflowTool = getToolByName(self.portal, "portal_workflow")
        workflowTool.setDefaultChain('simple_publication_workflow')

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:pingviini,项目名称:plone.app.multilingual,代码行数:15,代码来源:test_setup.py

示例13: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]
        alsoProvides(self.request, IPloneAppMultilingualInstalled)
        language_tool = getToolByName(self.portal, "portal_languages")
        language_tool.addSupportedLanguage("ca")
        language_tool.addSupportedLanguage("es")

        workflowTool = getToolByName(self.portal, "portal_workflow")
        workflowTool.setDefaultChain("simple_publication_workflow")

        setupTool = SetupMultilingualSite()
        setupTool.setupSite(self.portal)
开发者ID:khink,项目名称:plone.app.multilingual,代码行数:15,代码来源:test_lrf.py

示例14: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, "portal_languages")
            language_tool.addSupportedLanguage("ca")
            language_tool.addSupportedLanguage("es")

            # Enable request negotiator
            language_tool.use_request_negotiation = True

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
开发者ID:urska19,项目名称:Plone-test,代码行数:15,代码来源:testing.py

示例15: setUp

# 需要导入模块: from plone.app.multilingual.browser.setup import SetupMultilingualSite [as 别名]
# 或者: from plone.app.multilingual.browser.setup.SetupMultilingualSite import setupSite [as 别名]
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        alsoProvides(self.request, IPloneAppMultilingualInstalled)
        language_tool = getToolByName(self.portal, 'portal_languages')
        language_tool.addSupportedLanguage('ca')
        language_tool.addSupportedLanguage('es')

        workflowTool = getToolByName(self.portal, "portal_workflow")
        workflowTool.setDefaultChain('simple_publication_workflow')

        setupTool = SetupMultilingualSite()
        setupTool.folder_type = 'dxfolder'
        setupTool.setupSite(self.portal)

        self.a_ca = makeContent(self.portal.ca, 'dxdoc', id='a_ca')
开发者ID:fredvd,项目名称:plone.app.multilingual,代码行数:18,代码来源:test_api.py


注:本文中的plone.app.multilingual.browser.setup.SetupMultilingualSite.setupSite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。