def delete_file(sender, instance, **kwargs): if sender == SourceFile or sender == ResourceVariant: if settings.AWS_ENABLED: try: s3.delete_file('source', instance.s3_path) except: logger.exception("Failed to delete S3 file") else: try: os.unlink(instance.local_filename) except OSError: pass
def delete_file(sender, instance, **kwargs): if sender == SourceFile or sender == ResourceVariant: if settings.AWS_ENABLED: try: s3.delete_file('source', instance.s3_path) except: traceback.print_exc() else: try: os.unlink(instance.local_filename) except OSError: pass
def delete_file(sender, instance, **kwargs): if sender == SourceFile or sender == ResourceVariant: if settings.AWS_ENABLED: try: s3.delete_file(instance.s3_path) except: traceback.print_exc() else: try: os.unlink(instance.local_filename) except OSError: pass
def delete_file(sender, instance, **kwargs): if issubclass(sender, S3File): if settings.AWS_ENABLED: try: s3.delete_file(sender.bucket_name, instance.s3_path) except: logger.exception("Failed to delete S3 file") else: try: os.unlink(instance.local_filename) except OSError: pass