Skip to content

Commit

Permalink
add some debug and give job mimetype a @Property decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
tykling committed Nov 5, 2024
1 parent bb38672 commit c03bd54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jobs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/jobs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit c03bd54

Please sign in to comment.