本文整理汇总了Python中plone.multilingual.interfaces.ITranslationManager.image方法的典型用法代码示例。如果您正苦于以下问题:Python ITranslationManager.image方法的具体用法?Python ITranslationManager.image怎么用?Python ITranslationManager.image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.multilingual.interfaces.ITranslationManager
的用法示例。
在下文中一共展示了ITranslationManager.image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: objectTranslated
# 需要导入模块: from plone.multilingual.interfaces import ITranslationManager [as 别名]
# 或者: from plone.multilingual.interfaces.ITranslationManager import image [as 别名]
def objectTranslated(ob, event):
createdEvent(ob, event)
if ITranslatable.providedBy(ob):
if ob.language == "en" and ob.portal_type != "Folder":
if not hasattr(ob, 'slideshow'):
if ITranslationManager(ob).has_translation('nl'):
original_ob = ITranslationManager(ob).get_translation('nl')
if hasattr(original_ob, 'slideshow'):
slideshow = original_ob['slideshow']
ITranslationManager(slideshow).add_translation('en')
slideshow_trans = ITranslationManager(slideshow).get_translation('en')
slideshow_trans.title = slideshow.title
slideshow_trans.portal_workflow.doActionFor(slideshow_trans, "publish", comment="Slideshow published")
for sitem in slideshow:
if slideshow[sitem].portal_type == "Image":
ITranslationManager(slideshow[sitem]).add_translation('en')
trans = ITranslationManager(slideshow[sitem]).get_translation('en')
trans.image = slideshow[sitem].image
addCropToTranslation(slideshow[sitem], trans)
ob.reindexObject()
ob.reindexObject(idxs=["hasMedia"])
ob.reindexObject(idxs=["leadMedia"])
else:
ob.invokeFactory(
type_name="Folder",
id=u'slideshow',
title='slideshow',
)
folder = ob['slideshow']
ILanguage(folder).set_language(ob.language)
try:
folder.portal_workflow.doActionFor(folder, "publish", comment="Slideshow content automatically published")
ob.reindexObject()
except:
pass
# TODO - check if NL has slideshow
return
return