Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #807 from Avaiga/fix/accept_changing_name_through_…
Browse files Browse the repository at this point in the history
…property_dict

Accept to set a data node name using the property dict
  • Loading branch information
jrobinAV authored Oct 26, 2023
2 parents 9974b34 + f2fa498 commit ec546c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/taipy/core/data/_data_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _entity_to_model(cls, data_node: DataNode) -> _DataNodeModel:
data_node.config_id,
data_node._scope,
data_node.storage_type(),
data_node._name,
properties.pop("name", None) or data_node._name,
data_node.owner_id,
list(data_node._parent_ids),
data_node._last_edit_date.isoformat() if data_node._last_edit_date else None,
Expand Down
11 changes: 11 additions & 0 deletions tests/core/data/test_data_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,3 +913,14 @@ def test_explicit_label(self):
)
assert dn.get_label() == "a label"
assert dn.get_simple_label() == "a label"

def test_change_data_node_name(self):
cgf = Config.configure_data_node("foo", scope=Scope.GLOBAL)
dn = tp.create_global_data_node(cgf)

dn.name = "bar"
assert dn.name == "bar"

# This new syntax will be the only one allowed: https://github.com/Avaiga/taipy-core/issues/806
dn.properties["name"] = "baz"
assert dn.name == "baz"

0 comments on commit ec546c2

Please sign in to comment.