Пример #1
0
 def _delete_files(self, item: Model):
     for file_col in self.get_file_column_list():
         if self.is_file(file_col):
             if getattr(item, file_col):
                 fm = FileManager()
                 fm.delete_file(getattr(item, file_col))
     for file_col in self.get_image_column_list():
         if self.is_image(file_col):
             if getattr(item, file_col):
                 im = ImageManager()
                 im.delete_file(getattr(item, file_col))
Пример #2
0
def receive_after_delete(mapper, connection, target):
    "listen for the 'after_delete' event"
    #log.error("target", target, target.file)
    if target.file:
        im = ImageManager()
        im.delete_file(target.file)