+ def remove(self, db_conn: DatabaseConnection) -> None:
+ """Remove from DB, with dependencies.
+
+ Guard against removal of Processes in use.
+ """
+ assert isinstance(self.id_, int)
+ for _ in db_conn.row_where('process_steps', 'step_process', self.id_):
+ raise HandledException('cannot remove Process in use')
+ for _ in db_conn.row_where('todos', 'process', self.id_):
+ raise HandledException('cannot remove Process in use')
+ for step in self.explicit_steps:
+ step.remove(db_conn)
+ super().remove(db_conn)
+