matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.24k stars 276 forks source link

cachefile_storage accept callable which returns a storage object #525

Closed pickfire closed 2 years ago

pickfire commented 3 years ago

A storage object, or a callable which returns a storage object. This handles the storage and retrieval of your files. See Managing files for details on how to provide this object.

But imagekit only accepts a storage object. It should supports a callable which returns a storage object for feature parity with django.

So rather than doing cachefile_storage=S3Boto3Storage(), one can just do cachefile_storage=S3Boto3Storage.

https://github.com/matthewwithanm/django-imagekit/blob/f6ed35f060c30924a4c91ecd833847ceaec346cc/imagekit/cachefiles/__init__.py#L43-L45

vstoykov commented 3 years ago

Thank you for reporting the issue. Do you think that you can be able to prepare a PR with a fix for that?

bodgerbarnett commented 1 year ago

I've just been trying to use this fix and it looks like the change makes the storage callable - not the cachefile_storage. Or have I misunderstood something here?

pickfire commented 1 year ago

Yeah, looks like it, I noticed it in our project too but I didn't submit a pull request, supposedly it should also check if cachefile_storage is callable.