Skip to content

Commit

Permalink
fix: _update() method should update the internal attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
trgiangdo committed Dec 13, 2023
1 parent d8afb99 commit 12eb2b7
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions taipy/core/config/core_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def __init__(
self._read_entity_retry = (
read_entity_retry if read_entity_retry is not None else self._DEFAULT_READ_ENTITY_RETRY
)
self.mode = mode
self.version_number = version_number
self.force = force
self._mode = mode
self._version_number = version_number
self._force = force

self._check_compatibility(core_version)
self._core_version = core_version
Expand Down Expand Up @@ -171,6 +171,33 @@ def read_entity_retry(self):
def read_entity_retry(self, val):
self._read_entity_retry = val

@property
def mode(self):
return _tpl._replace_templates(self._mode)

@mode.setter # type: ignore
@_ConfigBlocker._check()
def mode(self, val):
self._mode = val

@property
def version_number(self):
return _tpl._replace_templates(self._version_number)

@version_number.setter # type: ignore
@_ConfigBlocker._check()
def version_number(self, val):
self._version_number = val

@property
def force(self):
return _tpl._replace_templates(self._force)

@force.setter # type: ignore
@_ConfigBlocker._check()
def force(self, val):
self._force = val

@classmethod
def default_config(cls):
return CoreSection(
Expand Down Expand Up @@ -245,14 +272,14 @@ def _from_dict(cls, as_dict: Dict[str, Any], id=None, config: Optional[_Config]
)

def _update(self, as_dict: Dict[str, Any]):
self.root_folder = as_dict.pop(self._ROOT_FOLDER_KEY, self._root_folder)
self.storage_folder = as_dict.pop(self._STORAGE_FOLDER_KEY, self._storage_folder)
self._root_folder = as_dict.pop(self._ROOT_FOLDER_KEY, self._root_folder)
self._storage_folder = as_dict.pop(self._STORAGE_FOLDER_KEY, self._storage_folder)
self._repository_type = as_dict.pop(self._REPOSITORY_TYPE_KEY, self._repository_type)
self._repository_properties.update(as_dict.pop(self._REPOSITORY_PROPERTIES_KEY, self._repository_properties))
self._read_entity_retry = as_dict.pop(self._READ_ENTITY_RETRY_KEY, self._read_entity_retry)
self.mode = as_dict.pop(self._MODE_KEY, self.mode)
self.version_number = as_dict.pop(self._VERSION_NUMBER_KEY, self.version_number)
self.force = as_dict.pop(self._FORCE_KEY, self.force)
self._mode = as_dict.pop(self._MODE_KEY, self.mode)
self._version_number = as_dict.pop(self._VERSION_NUMBER_KEY, self.version_number)
self._force = as_dict.pop(self._FORCE_KEY, self.force)

core_version = as_dict.pop(self._CORE_VERSION_KEY, None)
self._check_compatibility(core_version)
Expand Down

0 comments on commit 12eb2b7

Please sign in to comment.