本文整理汇总了Python中plone.app.multilingual.interfaces.ITranslationManager.values方法的典型用法代码示例。如果您正苦于以下问题:Python ITranslationManager.values方法的具体用法?Python ITranslationManager.values怎么用?Python ITranslationManager.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.multilingual.interfaces.ITranslationManager
的用法示例。
在下文中一共展示了ITranslationManager.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setContentsInActionMenu
# 需要导入模块: from plone.app.multilingual.interfaces import ITranslationManager [as 别名]
# 或者: from plone.app.multilingual.interfaces.ITranslationManager import values [as 别名]
def setContentsInActionMenu(self, value):
self.settings.contents_in_action_menu = value
portal = root = api.portal.get()
if 'fr' in root.objectIds():
fr = getattr(root, 'fr')
root = api.portal.get_navigation_root(fr)
catalog = api.portal.get_tool('portal_catalog')
name = 'cpskin.core.vocabularies.action_menu_eligible'
factory = getUtility(IVocabularyFactory, name)
vocabulary = factory(portal)
all_values = vocabulary.by_value.keys()
for content_id in all_values:
content = getattr(root, content_id, None)
if not content:
continue
translations = {'fr': content}
request = getattr(self.context, 'REQUEST', None)
if is_plone_app_multilingual_installed(request):
translations = ITranslationManager(content).get_translations()
if content_id in value:
for t in translations.values():
if IElectedContentForTopMenu.providedBy(t):
continue
alsoProvides(t, IElectedContentForTopMenu)
catalog.reindexObject(t)
else:
for t in translations.values():
if not IElectedContentForTopMenu.providedBy(t):
continue
noLongerProvides(t, IElectedContentForTopMenu)
catalog.reindexObject(t)