X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=plomtask%2Fdb.py;fp=plomtask%2Fdb.py;h=853b4c68c65780e339b77785b961788370373648;hb=e3bfd84f9061d5f03ec5f5764f75e4137505ea45;hp=385e79855286c45087537b3b63b8b024fd553ca0;hpb=1e4c7cd5cde09a5c58bc601cae3f5a49eb615399;p=plomtask diff --git a/plomtask/db.py b/plomtask/db.py index 385e798..853b4c6 100644 --- a/plomtask/db.py +++ b/plomtask/db.py @@ -344,7 +344,7 @@ class BaseModel(Generic[BaseModelId]): return obj return None - def _cache(self) -> None: + def cache(self) -> None: """Update object in class's cache. Also calls ._disappear if cache holds older reference to object of same @@ -383,7 +383,7 @@ class BaseModel(Generic[BaseModelId]): table_name = attr.table_name for row_ in db_conn.row_where(table_name, 'parent', obj.id_): attr.history_from_row(row_) - obj._cache() + obj.cache() return obj @classmethod @@ -497,7 +497,7 @@ class BaseModel(Generic[BaseModelId]): values) if not isinstance(self.id_, str): self.id_ = cursor.lastrowid # type: ignore[assignment] - self._cache() + self.cache() for attr_name in self.to_save_versioned: getattr(self, attr_name).save(db_conn) for table, column, attr_name, key_index in self.to_save_relations: