当前位置: 首页>>代码示例>>Python>>正文


Python IAnnotations.split方法代码示例

本文整理汇总了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
开发者ID:,项目名称:,代码行数:17,代码来源:


注:本文中的zope.annotation.IAnnotations.split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。