fix #516: thumbnail_cleanup command for S3 and different source storages #562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was able to make partial fix for #516.
It enables
thumbnail_cleanup
to work correctly with S3 stoarges and works with different source and destination storage.The default source storage is now set to
DEFAULT_FILE_STORAGE
(which is probably better choice in case when the source and destination storages differ), and can be changed by the management command--source-storage
parameter.It also adds check for the source storage hash, and if the hashes differ, it only prints warning, but take no action.
May be we could detect all possible storages and compare their hashes with the
source.storage_hash
value. But I am not sure, if I can load all storage options from settings. The situation would be much easier, if the storage classpath string is stored directly in theSource
objects.Also this change doesn't cove cases, when user wants to change the source storages. In such cases it might be useful either to change the source hash or to delete the thumbnail reference based on users requirements.