Пример #1
0
 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
Пример #2
0
 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")
Пример #3
0
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()
Пример #4
0
 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