(self, case_update, xform)
Gets or updates an existing case, based on a block of data in a
        submitted form.  Doesn't save anything. Returns a CaseUpdateMetadata object.
Gets or updates an existing case, based on a block of data in a
        submitted form.  Doesn't save anything. Returns a CaseUpdateMetadata object.
Gets or updates an existing case based on a block of data in a submitted form . Doesn t save anything . Returns a CaseUpdateMetadata object .
def get_case_from_case_update(self, case_update, xform):
        """
        Gets or updates an existing case, based on a block of data in a
        submitted form.  Doesn't save anything. Returns a CaseUpdateMetadata object.
        """
        case = self.get(case_update.id)
        actions = {action.action_type_slug for action in case_update.actions}
        if case is None:
            if xform.metadata and xform.metadata.commcare_version:
                from distutils.version import LooseVersion
                commcare_version = xform.metadata.commcare_version
                message = "Case created without create block"
                send_to = None
                if commcare_version >= LooseVersion("2.44"):
                    send_to = "{}@{}.com".format('skelly', 'dimagi')
                    message += " in CC version >= 2.44"
                soft_assert(to=send_to)(
                    case_update.creates_case(),
                    message, {
                        'xform_id': xform.form_id,
                        'case_id': case_update.id,
                        'domain': xform.domain,
                        'version': str(commcare_version)
                    }
                )
            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, actions=actions)
        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, actions=actions)
def get_case_from_case_update ( self , case_update , xform ) : case = self . get ( case_update . id ) actions = { action . action_type_slug for action in case_update . actions } if case is None : if xform . metadata and xform . metadata . commcare_version : from distutils . version import LooseVersion commcare_version = xform . metadata . commcare_version message = "Case created without create block" send_to = None if commcare_version >= LooseVersion ( "2.44" ) : send_to = "{}@{}.com" . format ( 'skelly' , 'dimagi' ) message += " in CC version >= 2.44" soft_assert ( to = send_to ) ( case_update . creates_case ( ) , message , { 'xform_id' : xform . form_id , 'case_id' : case_update . id , 'domain' : xform . domain , 'version' : str ( commcare_version ) } ) 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 , actions = actions ) 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 , actions = actions )