1
0
Fork 0

linting and tests

This commit is contained in:
Hugh Rundle 2024-01-28 20:35:47 +11:00
parent a3e05254b5
commit 2c231acebe
No known key found for this signature in database
GPG key ID: A7E35779918253F9
5 changed files with 28 additions and 106 deletions

View file

@ -160,7 +160,8 @@ class ExportUser(View):
export = {"job": job}
if settings.USE_S3:
# make custom_domain None so we can sign the url (https://github.com/jschneier/django-storages/issues/944)
# make custom_domain None so we can sign the url
# see https://github.com/jschneier/django-storages/issues/944
storage = S3Boto3Storage(querystring_auth=True, custom_domain=None)
# for s3 we download directly from s3, so we need a signed url
@ -168,12 +169,13 @@ class ExportUser(View):
storage, f"/exports/{job.task_id}.tar.gz", expire=900
) # temporarily downloadable file, expires after 5 minutes
# for s3 we create a new tar file in s3, so we need to check the size of _that_ file
# for s3 we create a new tar file in s3,
# so we need to check the size of _that_ file
try:
export["size"] = S3Boto3Storage.size(
storage, f"exports/{job.task_id}.tar.gz"
)
except Exception:
except Exception: # pylint: disable=broad-except
export["size"] = 0
else: