(self, payload)
return self in repeaters
Forward the payload if ...

        * it did not come from OpenMRS, and
        * CaseRepeater says it's OK for the case types and users of any
          of the payload's cases, and
        * this repeater forwards to the right OpenMRS server for any of
          the payload's cases.

        :param payload: An XFormInstance (not a case)
Forward the payload if ...
Forward the payload if ...
def allowed_to_forward(self, payload):
        """
        Forward the payload if ...

        * it did not come from OpenMRS, and
        * CaseRepeater says it's OK for the case types and users of any
          of the payload's cases, and
        * this repeater forwards to the right OpenMRS server for any of
          the payload's cases.

        :param payload: An XFormInstance (not a case)

        """
        if payload.xmlns == XMLNS_OPENMRS:
            # payload came from OpenMRS. Don't send it back.
            return False

        case_blocks = extract_case_blocks(payload)
        case_ids = [case_block['@case_id'] for case_block in case_blocks]
        cases = CaseAccessors(payload.domain).get_cases(case_ids, ordered=True)
        if not any(CaseRepeater.allowed_to_forward(self, case) for case in cases):
            # If none of the case updates in the payload are allowed to
            # be forwarded, drop it.
            return False

        if not self.location_id:
            # If this repeater  does not have a location, all payloads
            # should go to it.
            return True

        repeaters = [repeater for case in cases for repeater in get_case_location_ancestor_repeaters(case)]
        # If this repeater points to the wrong OpenMRS server for this
        # payload then let the right repeater handle it.
        return self in repeaters
def allowed_to_forward ( self , payload ) : if payload . xmlns == XMLNS_OPENMRS : # payload came from OpenMRS. Don't send it back. return False case_blocks = extract_case_blocks ( payload ) case_ids = [ case_block [ '@case_id' ] for case_block in case_blocks ] cases = CaseAccessors ( payload . domain ) . get_cases ( case_ids , ordered = True ) if not any ( CaseRepeater . allowed_to_forward ( self , case ) for case in cases ) : # If none of the case updates in the payload are allowed to # be forwarded, drop it. return False if not self . location_id : # If this repeater  does not have a location, all payloads # should go to it. return True repeaters = [ repeater for case in cases for repeater in get_case_location_ancestor_repeaters ( case ) ] # If this repeater points to the wrong OpenMRS server for this # payload then let the right repeater handle it. return self in repeaters