def _update_civic_address(self, name, want, have): commands = [] for item in have: ca_type = item['ca_type'] ca_value = item['ca_value'] in_want = search_dict_tv_in_list(ca_type, ca_value, want, 'ca_type', 'ca_value') if not in_want: commands.append( self._compute_command(name, 'location civic-based ca-type', str(ca_type), remove=True)) return commands
def _add_civic_address(self, name, want, have): commands = [] for item in want: ca_type = item['ca_type'] ca_value = item['ca_value'] obj_in_have = search_dict_tv_in_list(ca_type, ca_value, have, 'ca_type', 'ca_value') if not obj_in_have: commands.append( self._compute_command(key=name + ' location civic-based ca-type', attrib=str(ca_type) + ' ca-value', value=ca_value)) return commands