本文整理汇总了Python中zope.annotation.IAnnotations.split方法的典型用法代码示例。如果您正苦于以下问题:Python IAnnotations.split方法的具体用法?Python IAnnotations.split怎么用?Python IAnnotations.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zope.annotation.IAnnotations
的用法示例。
在下文中一共展示了IAnnotations.split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assign_new_version_id_for_translation
# 需要导入模块: from zope.annotation import IAnnotations [as 别名]
# 或者: from zope.annotation.IAnnotations import split [as 别名]
def assign_new_version_id_for_translation(obj, event):
"""Assigns a version id to newly created translations
"""
version_prefix = get_version_prefix(obj)
if version_prefix:
target = event.target
canonical = obj.getCanonical()
if canonical is target:
return
decrement_version_prefix_number(version_prefix)
cvid = IAnnotations(canonical).get(VERSION_ID)
if version_prefix.prefix_with_language:
cvid = '-'.join(cvid.split('-')[:-1])
translation_vid = cvid + '-' + target.getLanguage()
IAnnotations(target)[VERSION_ID] = translation_vid