def on_deleted(self, event): with self.app.app_context(): if event.src_path.endswith(".md"): id = event.src_path.split("/")[-1].split("-")[0] search.remove_from_index(self.app.config['INDEX_NAME'], id) self.app.logger.info(f"{event.src_path} has been removed") self.last_delete_event = event.src_path
def on_deleted(self, event): with self.app.app_context(): filename = event.src_path.split("/")[-1] if re.match(DATAOBJ_REGEX, filename): id = event.src_path.split("/")[-1].split("-")[0] search.remove_from_index(self.app.config['INDEX_NAME'], id) self.app.logger.info(f"{event.src_path} has been removed")
def delete_item(dataobj_id): """Delete dataobj of given id""" file = get_by_id(dataobj_id) remove_from_index(dataobj_id) if file: Path(file).unlink()
def on_deleted(self, event): if event.src_path.endswith(".md"): id = event.src_path.split("/")[-1].split("-")[0] search.remove_from_index(Config.INDEX_NAME, id) print(f"{event.src_path} has been removed") self.last_delete_event = event.src_path