コード例 #1
0
 def delete(self, session, _id, force=False, dry_run=False):
     """
     Delete item by its internal _id
     :param session: contains the used login username, working project, and admin rights
     :param _id: server internal id
     :param force: indicates if deletion must be forced in case of conflict
     :param dry_run: make checking but do not delete
     :return: dictionary with deleted item _id. It raises EngineException on error: not found, conflict, ...
     """
     if dry_run or force:  # delete completely
         return BaseTopic.delete(self, session, _id, force, dry_run)
     else:  # if not sent to kafka
         v = BaseTopic.delete(self, session, _id, force, dry_run=True)
         self.db.set_one("sdns", {"_id": _id},
                         {"_admin.to_delete": True})  # TODO change status
         self._send_msg("delete", {"_id": _id})
         return v  # TODO indicate an offline operation to return 202 ACCEPTED
コード例 #2
0
 def delete(self, session, _id, force=False, dry_run=False):
     """
     Delete item by its internal _id
     :param session: contains the used login username, working project, and admin rights
     :param _id: server internal id
     :param force: indicates if deletion must be forced in case of conflict
     :param dry_run: make checking but do not delete
     :return: dictionary with deleted item _id. It raises EngineException on error: not found, conflict, ...
     """
     # TODO add admin to filter, validate rights
     v = BaseTopic.delete(self, session, _id, force, dry_run=True)
     if dry_run:
         return
     v = self.db.del_one(self.topic, {"_id": _id})
     self.fs.file_delete(_id, ignore_non_exist=True)
     self.fs.file_delete(_id + "_",
                         ignore_non_exist=True)  # remove temp folder
     self._send_msg("delete", {"_id": _id})
     return v