def submit_multi(self, dest_address=[], **kwargs): if self.state in ['BOUND_TX', 'BOUND_TRX']: sequence_number = self.get_seq() pdu = SubmitMulti(sequence_number, **dict(self.defaults, **kwargs)) for item in dest_address: if isinstance(item, str): # assume strings are addresses not lists pdu.addDestinationAddress( item, dest_addr_ton=self.defaults['dest_addr_ton'], dest_addr_npi=self.defaults['dest_addr_npi'], ) elif isinstance(item, dict): if item.get('dest_flag') == 1: pdu.addDestinationAddress( item.get('destination_addr', ''), dest_addr_ton=item.get( 'dest_addr_ton', self.defaults['dest_addr_ton']), dest_addr_npi=item.get( 'dest_addr_npi', self.defaults['dest_addr_npi']), ) elif item.get('dest_flag') == 2: pdu.addDistributionList(item.get('dl_name')) self.get_next_seq() self.send_pdu(pdu) return sequence_number return 0
def submit_multi(self, dest_address=[], **kwargs): if self.state in ['BOUND_TX', 'BOUND_TRX']: pdu = SubmitMulti( self.sequence_number, **dict(self.defaults, **kwargs)) for item in dest_address: # assume strings are addresses not lists if isinstance(item, str): pdu.addDestinationAddress( item, dest_addr_ton=self.defaults['dest_addr_ton'], dest_addr_npi=self.defaults['dest_addr_npi'], ) elif isinstance(item, dict): if item.get('dest_flag') == 1: pdu.addDestinationAddress( item.get('destination_addr', ''), dest_addr_ton=item.get( 'dest_addr_ton', self.defaults['dest_addr_ton']), dest_addr_npi=item.get( 'dest_addr_npi', self.defaults['dest_addr_npi']), ) elif item.get('dest_flag') == 2: pdu.addDistributionList(item.get('dl_name')) self.conn.send(pdu.get_bin()) self.sequence_number += 1 self.__recv()
def submit_multi(self, dest_address=[], **kwargs): if self.state in ['BOUND_TX', 'BOUND_TRX']: sequence_number = self.getSeq() pdu = SubmitMulti(sequence_number, **dict(self.defaults, **kwargs)) for item in dest_address: if isinstance(item, str): # assume strings are addresses not lists pdu.addDestinationAddress( item, dest_addr_ton=self.defaults['dest_addr_ton'], dest_addr_npi=self.defaults['dest_addr_npi'], ) elif isinstance(item, dict): if item.get('dest_flag') == 1: pdu.addDestinationAddress( item.get('destination_addr', ''), dest_addr_ton=item.get('dest_addr_ton', self.defaults['dest_addr_ton']), dest_addr_npi=item.get('dest_addr_npi', self.defaults['dest_addr_npi']), ) elif item.get('dest_flag') == 2: pdu.addDistributionList(item.get('dl_name')) self.incSeq() self.sendPDU(pdu) return sequence_number return 0