本文整理汇总了Python中pootle_store.models.Unit.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Unit.merge方法的具体用法?Python Unit.merge怎么用?Python Unit.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pootle_store.models.Unit
的用法示例。
在下文中一共展示了Unit.merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_termunit
# 需要导入模块: from pootle_store.models import Unit [as 别名]
# 或者: from pootle_store.models.Unit import merge [as 别名]
def create_termunit(term, unit, targets, locations, sourcenotes, transnotes,
filecounts):
termunit = Unit()
termunit.source = term
termunit.setid(term)
if unit is not None:
termunit.merge(unit)
termunit.pending_suggestions = []
for target in targets.keys():
if target != termunit.target:
termunit.pending_suggestions.append(target)
for location in locations:
termunit.addlocation(location)
for sourcenote in sourcenotes:
termunit.addnote(sourcenote, "developer")
for filename, count in filecounts.iteritems():
termunit.addnote('(poterminology) %s (%d)\n' % (filename, count),
'translator')
return termunit