- @classmethod
- def by_id(cls, db_conn: DatabaseConnection, id_: int | None,
- create: bool = False) -> Condition:
- """Collect (or create) Condition and its VersionedAttributes."""
- condition = None
- if id_:
- condition, _ = super()._by_id(db_conn, id_)
- if not condition:
- if not create:
- raise NotFoundException(f'Condition not found of id: {id_}')
- condition = cls(id_, False)
- condition.save(db_conn)
- return condition
-