diff --git a/src/main/emme/toolbox/import/import_network.py b/src/main/emme/toolbox/import/import_network.py index e2462a03a..305bae55e 100644 --- a/src/main/emme/toolbox/import/import_network.py +++ b/src/main/emme/toolbox/import/import_network.py @@ -777,13 +777,15 @@ def _create_base_net(self, data, network, mode_callback, centroid_callback, arc_ network_editor_yaml_file = FILE_NAMES["NETWORK_EDITS"] network_editor_bool = False network_editor_yaml_path = _join(self.source, network_editor_yaml_file) + self._log.append({"type": "header", "content": "__Network Edits"}) if os.path.exists(network_editor_yaml_path): network_editor_bool = True - self._log.append({"type": "text", "content": "%s" % network_editor_yaml_path}) with open(network_editor_yaml_path, "r") as stream: network_editor_data = yaml.safe_load(stream) - self._log.append({"type": "text", "content": "loaded YAML"}) - + self._log.append({"type": "text", "content": "Successfully loaded Network Edits YAML"}) + self._log.append({"type": "text", "content": "\tYAML Path: %s" % network_editor_yaml_path}) + else: + self._log.append({"type": "text", "content": "NO Network Edits YAML to load"}) # Create nodes and links for arc in data: @@ -807,15 +809,12 @@ def _create_base_net(self, data, network, mode_callback, centroid_callback, arc_ new_node_id += 1 #arc edits to raw_network - # if network_editor_bool: - if arc_id_name == "HWYCOV-ID": - for link_edits in network_editor_data.get('raw_network',[]): - if arc["HWYCOV-ID"] in link_edits.get("@tcov_id",[]): - #could explore using set_attribute_values() method in EMME API - try: + if network_editor_bool: + if arc_id_name == "HWYCOV-ID": + for link_edits in network_editor_data.get('raw_network',[]): + if arc["HWYCOV-ID"] in link_edits.get("@tcov_id",[]): + self._log.append({"type": "text", "content": "network edit descr: %s" % link_edits["descr"]}) arc[link_edits["attribute_to_edit"]] = link_edits["new_value"] - except KeyError: - setattr(arc, link_edits["attribute_to_edit"], link_edits["new_value"]) modes = mode_callback(arc) link = network.create_link(i_node, j_node, modes)