removes changed_attribute path after on_change method

This commit is contained in:
Mose Müller 2024-02-20 12:29:30 +01:00
parent c0ba23b0b2
commit dc42bfaa9b

View File

@ -14,11 +14,11 @@ class Observer(ABC):
self.changing_attributes: list[str] = [] self.changing_attributes: list[str] = []
def _notify_changed(self, changed_attribute: str, value: Any) -> None: def _notify_changed(self, changed_attribute: str, value: Any) -> None:
self.on_change(full_access_path=changed_attribute, value=value)
if changed_attribute in self.changing_attributes: if changed_attribute in self.changing_attributes:
self.changing_attributes.remove(changed_attribute) self.changing_attributes.remove(changed_attribute)
self.on_change(full_access_path=changed_attribute, value=value)
def _notify_change_start(self, changing_attribute: str) -> None: def _notify_change_start(self, changing_attribute: str) -> None:
self.changing_attributes.append(changing_attribute) self.changing_attributes.append(changing_attribute)
self.on_change_start(changing_attribute) self.on_change_start(changing_attribute)