- if not force:
- for p in indata["projects"]:
- if p == "admin":
- continue
- if not self.db.get_one("projects", {"_id": p}, fail_on_empty=False, fail_on_more=False):
- raise EngineException("project '{}' does not exists".format(p), HTTPStatus.CONFLICT)
-
- def check_conflict_on_del(self, session, _id, force=False):
+ if not session["force"]:
+ for p in indata.get("projects"):
+ # To allow project addressing by Name as well as ID
+ if not self.db.get_one("projects", {BaseTopic.id_field("projects", p): p}, fail_on_empty=False,
+ fail_on_more=False):
+ raise EngineException("project '{}' does not exist".format(p), HTTPStatus.CONFLICT)
+
+ def check_conflict_on_del(self, session, _id, db_content):
+ """
+ Check if deletion can be done because of dependencies if it is not force. To override
+ :param session: contains "username", "admin", "force", "public", "project_id", "set_project"
+ :param _id: internal _id
+ :param db_content: The database content of this item _id
+ :return: None if ok or raises EngineException with the conflict
+ """