- def __lt__(self, other: Condition) -> bool:
- assert isinstance(self.id_, int)
- assert isinstance(other.id_, int)
- return self.id_ < other.id_
-
- @classmethod
- def from_table_row(cls, db_conn: DatabaseConnection,
- row: Row | list[Any]) -> Condition:
- """Build condition from row, including VersionedAttributes."""
- condition = super().from_table_row(db_conn, row)
- for name in ('title', 'description'):
- table_name = f'condition_{name}s'
- for row_ in db_conn.row_where(table_name, 'parent', row[0]):
- getattr(condition, name).history_from_row(row_)
- return condition
-
- def save(self, db_conn: DatabaseConnection) -> None:
- """Save self and its VersionedAttributes to DB and cache."""
- self.save_core(db_conn)
- self.title.save(db_conn)
- self.description.save(db_conn)
-