本文整理汇总了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")
示例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])
示例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()
示例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
示例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()
示例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,
)
示例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)
示例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()
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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')