From eb37e644c205814203f54d42fbe94ceb3e71dd35 Mon Sep 17 00:00:00 2001 From: Olivier Leger Date: Thu, 4 Jul 2024 13:34:39 -0400 Subject: [PATCH] Fix boto3 monkey patching for S3 --- onadata/apps/storage_backends/s3boto3.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/onadata/apps/storage_backends/s3boto3.py b/onadata/apps/storage_backends/s3boto3.py index 5e50c108d..287273079 100644 --- a/onadata/apps/storage_backends/s3boto3.py +++ b/onadata/apps/storage_backends/s3boto3.py @@ -2,10 +2,12 @@ import logging -import storages.backends.s3boto3 as upstream +import storages.backends.s3 as upstream +from django.utils.deconstruct import deconstructible -class S3Boto3StorageFile(upstream.S3Boto3StorageFile): +@deconstructible +class S3File(upstream.S3File): def __init__(self, name, mode, storage, buffer_size=None): super().__init__(name, mode, storage, buffer_size) self._remote_file_size = 0 @@ -31,9 +33,10 @@ def _flush_write_buffer(self): self.file.truncate() -upstream.S3Boto3StorageFile = S3Boto3StorageFile +upstream.S3File = S3File -class S3Boto3Storage(upstream.S3Boto3Storage): - # Uses the overridden S3Boto3StorageFile +@deconstructible +class S3Boto3Storage(upstream.S3Storage): + # Uses the overridden S3File pass