From 779a23b32091d2c4ed35f9e5ec9b06a8987b072c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 9 Aug 2023 09:05:19 +0200 Subject: [PATCH] fix. read-only attributes are not upated with values from json --- src/pydase/data_service/data_service.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pydase/data_service/data_service.py b/src/pydase/data_service/data_service.py index bc8bfbf..db67ab8 100644 --- a/src/pydase/data_service/data_service.py +++ b/src/pydase/data_service/data_service.py @@ -141,6 +141,15 @@ class DataService(rpyc.Service, AbstractDataService): serialized_class, path=path, key="type" ) if class_value_type == value_type: + class_attr_is_read_only = get_nested_value_by_path_and_key( + serialized_class, path=path, key="readonly" + ) + if class_attr_is_read_only: + logger.debug( + f'Attribute "{path}" is read-only. Ignoring value from JSON ' + "file..." + ) + continue # Split the path into parts parts = path.split(".") attr_name = parts[-1]