|
23 | 23 | from markupsafe import Markup
|
24 | 24 |
|
25 | 25 | import webapp.home.utils.create_nodes
|
26 |
| -import webapp.home.utils.node_utils |
| 26 | +# import webapp.home.utils.node_utils |
27 | 27 | import webapp.views.data_tables.load_data
|
28 | 28 | from webapp.config import Config
|
29 | 29 |
|
|
51 | 51 | )
|
52 | 52 |
|
53 | 53 | from webapp.home.metapype_client import VariableType
|
54 |
| -from webapp.home.utils.node_utils import remove_child, new_child_node, add_child |
| 54 | +from webapp.home.utils.node_utils import remove_child, new_child_node, add_child, replace_node |
55 | 55 | from webapp.home.utils.hidden_buttons import is_hidden_button, handle_hidden_buttons, check_val_for_hidden_buttons
|
56 | 56 | from webapp.home.utils.node_store import dump_node_store
|
57 | 57 | from webapp.home.utils.load_and_save import load_eml, save_both_formats, handle_custom_unit_additional_metadata
|
@@ -269,9 +269,7 @@ def compose_atts(att_list: list = []):
|
269 | 269 |
|
270 | 270 | # If we're modifying an existing data table, we need to replace the old data table node with the
|
271 | 271 | # new one.
|
272 |
| - dataset_parent_node = old_dt_node.parent |
273 |
| - dataset_parent_node.replace_child(old_dt_node, dt_node) |
274 |
| - dt_node_id = dt_node.id |
| 272 | + replace_node(dt_node, old_dt_node.id) |
275 | 273 | else:
|
276 | 274 | msg = f"No node found in the node store with node id {dt_node_id}"
|
277 | 275 | dump_node_store(eml_node, 'data_table')
|
@@ -1300,8 +1298,7 @@ def attribute_dateTime(filename=None, dt_node_id=None, node_id=None):
|
1300 | 1298 | if node_id and len(node_id) != 1:
|
1301 | 1299 | old_att_node = Node.get_node_instance(att_node_id)
|
1302 | 1300 | if old_att_node:
|
1303 |
| - att_parent_node = old_att_node.parent |
1304 |
| - att_parent_node.replace_child(old_att_node, att_node) |
| 1301 | + replace_node(att_node, old_att_node.id) |
1305 | 1302 | else:
|
1306 | 1303 | msg = f"No node found in the node store with node id {node_id}"
|
1307 | 1304 | dump_node_store(eml_node, 'attribute_dateTime')
|
@@ -1547,8 +1544,7 @@ def attribute_numerical(filename=None, dt_node_id=None, node_id=None, mscale=Non
|
1547 | 1544 | if node_id and len(node_id) != 1:
|
1548 | 1545 | old_att_node = Node.get_node_instance(att_node_id)
|
1549 | 1546 | if old_att_node:
|
1550 |
| - att_parent_node = old_att_node.parent |
1551 |
| - att_parent_node.replace_child(old_att_node, att_node) |
| 1547 | + replace_node(att_node, old_att_node.id) |
1552 | 1548 | else:
|
1553 | 1549 | msg = f"No node found in the node store with node id {node_id}"
|
1554 | 1550 | dump_node_store(eml_node, 'attribute_numerical')
|
@@ -1858,8 +1854,7 @@ def code_definition_from_attribute(att_node: Node = None):
|
1858 | 1854 | if node_id and len(node_id) != 1:
|
1859 | 1855 | old_att_node = Node.get_node_instance(att_node_id)
|
1860 | 1856 | if old_att_node:
|
1861 |
| - att_parent_node = old_att_node.parent |
1862 |
| - att_parent_node.replace_child(old_att_node, att_node) |
| 1857 | + replace_node(att_node, old_att_node.id) |
1863 | 1858 | else:
|
1864 | 1859 | msg = f"No node found in the node store with node id {node_id}"
|
1865 | 1860 | dump_node_store(eml_node, 'attribute_categorical')
|
|
0 commit comments