本文整理汇总了Python中casexml.apps.case.models.CommCareCase.from_case_update方法的典型用法代码示例。如果您正苦于以下问题:Python CommCareCase.from_case_update方法的具体用法?Python CommCareCase.from_case_update怎么用?Python CommCareCase.from_case_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类casexml.apps.case.models.CommCareCase
的用法示例。
在下文中一共展示了CommCareCase.from_case_update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_or_update_model
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import from_case_update [as 别名]
def _get_or_update_model(case_update, xform, case_db):
"""
Gets or updates an existing case, based on a block of data in a
submitted form. Doesn't save anything.
"""
case = case_db.get(case_update.id)
if case is None:
case = CommCareCase.from_case_update(case_update, xform)
case_db.set(case['_id'], case)
return case
else:
case.update_from_case_update(case_update, xform, case_db.get_cached_forms())
return case
示例2: _get_or_update_model
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import from_case_update [as 别名]
def _get_or_update_model(case_block, xformdoc, case_dbcache):
"""
Gets or updates an existing case, based on a block of data in a
submitted form. Doesn't save anything.
"""
case_update = case_update_from_block(case_block)
case_doc = case_dbcache.get(case_update.id)
if case_doc == None:
case_doc = CommCareCase.from_case_update(case_update, xformdoc)
return case_doc
else:
case_doc.update_from_case_update(case_update, xformdoc)
return case_doc