se adiciona @fields.on_change para ejecutar funcion cuando se cambian los varoles de algun attributo

FossilOrigin-Name: bee19b201f8c1a6b972c2a9abfe5fb57a558a67be6ecddce4f7f07b5b6980215
This commit is contained in:
bit4bit
2021-06-25 23:21:04 +00:00
parent b6219bd171
commit c694603505
7 changed files with 77 additions and 2 deletions

View File

@@ -39,3 +39,8 @@ class Field:
self._set_namespace(obj, self.namespace, inst.__namespace__)
inst._fields[self.name] = obj
return obj
def _changed_field(self, inst, name, value):
for fun in inst._on_change_fields[name]:
getattr(inst, fun)(name, value)