(self, to_remove, all_to_remove, checked_case_id, xform_id)
Removes case from index trees, case_ids_on_phone and dependent_case_ids_on_phone if pertinent
Removes case from index trees, case_ids_on_phone and dependent_case_ids_on_phone if pertinent
Removes case from index trees case_ids_on_phone and dependent_case_ids_on_phone if pertinent
def _remove_case(self, to_remove, all_to_remove, checked_case_id, xform_id):
        """Removes case from index trees, case_ids_on_phone and dependent_case_ids_on_phone if pertinent"""
        _get_logger().debug('removing: {}'.format(to_remove))

        deleted_indices = self.index_tree.indices.pop(to_remove, {})
        deleted_indices.update(self.extension_index_tree.indices.pop(to_remove, {}))

        self._validate_case_removal(to_remove, all_to_remove, deleted_indices, checked_case_id, xform_id)

        try:
            self.case_ids_on_phone.remove(to_remove)
        except KeyError:
            should_fail_softly = not xform_id or _domain_has_legacy_toggle_set()
            if should_fail_softly:
                pass
            else:
                # this is only a soft assert for now because of http://manage.dimagi.com/default.asp?181443
                # we should convert back to a real Exception when we stop getting any of these
                _assert = soft_assert(notify_admins=True, exponential_backoff=False)
                _assert(False, 'case already remove from synclog', {
                    'case_id': to_remove,
                    'synclog_id': self._id,
                    'form_id': xform_id
                })
        else:
            self.purged_cases.add(to_remove)

        if to_remove in self.dependent_case_ids_on_phone:
            self.dependent_case_ids_on_phone.remove(to_remove)
def _remove_case ( self , to_remove , all_to_remove , checked_case_id , xform_id ) : _get_logger ( ) . debug ( 'removing: {}' . format ( to_remove ) ) deleted_indices = self . index_tree . indices . pop ( to_remove , { } ) deleted_indices . update ( self . extension_index_tree . indices . pop ( to_remove , { } ) ) self . _validate_case_removal ( to_remove , all_to_remove , deleted_indices , checked_case_id , xform_id ) try : self . case_ids_on_phone . remove ( to_remove ) except KeyError : should_fail_softly = not xform_id or _domain_has_legacy_toggle_set ( ) if should_fail_softly : pass else : # this is only a soft assert for now because of http://manage.dimagi.com/default.asp?181443 # we should convert back to a real Exception when we stop getting any of these _assert = soft_assert ( notify_admins = True , exponential_backoff = False ) _assert ( False , 'case already remove from synclog' , { 'case_id' : to_remove , 'synclog_id' : self . _id , 'form_id' : xform_id } ) else : self . purged_cases . add ( to_remove ) if to_remove in self . dependent_case_ids_on_phone : self . dependent_case_ids_on_phone . remove ( to_remove )