本文整理汇总了Python中plone.multilingual.interfaces.ITranslationManager.objectValues方法的典型用法代码示例。如果您正苦于以下问题:Python ITranslationManager.objectValues方法的具体用法?Python ITranslationManager.objectValues怎么用?Python ITranslationManager.objectValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.multilingual.interfaces.ITranslationManager
的用法示例。
在下文中一共展示了ITranslationManager.objectValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAlbumContent
# 需要导入模块: from plone.multilingual.interfaces import ITranslationManager [as 别名]
# 或者: from plone.multilingual.interfaces.ITranslationManager import objectValues [as 别名]
def getAlbumContent(self,
container=None,
images=0,
folders=0,
subimages=0,
others=0):
""" Mostly ripped out from atctListAlbum.py
"""
if not container:
container = self.context
# language fallback
default_lang = api.portal.get_tool(
"portal_languages").getDefaultLanguage()
if container.Language() != default_lang:
container = ITranslationManager(container).get_translation(default_lang)
contents = container.objectValues()
result = {}
if images:
result['images'] = [x for x in contents if x.portal_type == 'Image']
if folders:
result['folders'] = [x for x in contents if x.portal_type == 'Folder']
if subimages:
# in this case, container is a sub-folder of the main photo gallery
result['subimages'] = [x for x in contents if x.portal_type == 'Image']
# if others:
# utils = getToolByName(self.context, 'plone_utils')
# searchContentTypes = utils.getUserFriendlyTypes()
# filtered = [p_type for p_type in searchContentTypes
# if p_type not in ('Image', 'Folder',)]
# if filtered:
# # We don't need the full objects for the folder_listing
# result['others'] = container.getFolderContents(
# {'portal_type': filtered})
# else:
# result['others'] = ()
result['others'] = ()
return result