From c03bd54a4f19d07006a1c9f380fd637f85c523e0 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 5 Nov 2024 08:36:39 +0100 Subject: [PATCH] add some debug and give job mimetype a @property decorator --- src/jobs/api.py | 4 ++++ src/jobs/models.py | 1 + 2 files changed, 5 insertions(+) diff --git a/src/jobs/api.py b/src/jobs/api.py index 77243455..459b0495 100644 --- a/src/jobs/api.py +++ b/src/jobs/api.py @@ -180,6 +180,10 @@ def upload_result( if job.job_type == "ImageConversionJob": path, filename = job.get_result_path() FileSystemStorage(location=path).save(filename, f) + logger.debug( + f"Job {job.pk} wrote {(path/filename).stat().st_size} bytes {job.width}x{job.height}" + f"{job.mimetype} image to path {path / filename}" + ) elif job.job_type == "ImageExifExtractionJob": exif = json.load(f) basefile.exif = exif diff --git a/src/jobs/models.py b/src/jobs/models.py index 1a0e5092..5b4e4bdd 100644 --- a/src/jobs/models.py +++ b/src/jobs/models.py @@ -127,6 +127,7 @@ def get_result_path(self) -> tuple[Path, str]: filename = f"{self.width}w.{self.filetype.lower()}" return path, filename + @property def mimetype(self) -> str: """Get the value for the mimetype field.""" for mimetype, extension in settings.ALLOWED_IMAGE_TYPES.items():