

def get_case_from_case_update(self, case_update, xform):
    "\n        Gets or updates an existing case, based on a block of data in a\n        submitted form.  Doesn't save anything. Returns a CaseUpdateMetadata object.\n        "
    case = self.get(case_update.id)
    if (case is None):
        case = self.case_update_strategy.case_from_case_update(case_update, xform)
        self.set(case.case_id, case)
        return CaseUpdateMetadata(case, is_creation=True, previous_owner_id=None)
    else:
        previous_owner = case.owner_id
        self.case_update_strategy(case).update_from_case_update(case_update, xform, self.get_cached_forms())
        return CaseUpdateMetadata(case, is_creation=False, previous_owner_id=previous_owner)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/form_processor/casedb_base.py AbstractCaseDbCache.get_case_from_case_update/original