Use cases:
* purging files in CDNs
* generating derivative assets
* virus scanning
Proposed Signals:
* post_save
* post_delete
My initial thoughts on the implementation would be to modify
Storage.delete to delegate to ._delete like .save and to put the signal
triggering in .save and .delete. Alternatively, it could be implemented in
a Mixin like we are doing in our project.
{{{
storage_post_save = Signal()
storage_post_delete = Signal()
class SignalingStorageMixin:
def save(self, name, content, max_length=None):
super().save(name, content, max_length)
# send a signal so we can react as files are uploaded in order to
purge the cache.
storage_post_save.send(sender=self.__class__, name=name)
def delete(self, name):
"""
Delete the specified file from the storage system.
"""
super().delete(name)
storage_post_delete.send(sender=self.__class__, name=name)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34575>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Darrel O'Pry (added)
* keywords: => storage signals
* component: Uncategorized => File uploads/storage
* type: Uncategorized => New feature
--
Ticket URL: <https://code.djangoproject.com/ticket/34575#comment:1>
* status: new => closed
* resolution: => wontfix
Comment:
Hello Darrel! The current procedure to
[https://docs.djangoproject.com/en/dev/internals/contributing/bugs-and-
features/#requesting-features propose/request new features] is to post a
new message to the [https://forum.djangoproject.com/c/internals/5 Django
Forum] to reach a wider audience and to get community consensus there.
Once there is an agreement and desire to include the proposed feature in
Django, this ticket can be re-opened. Thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/34575#comment:2>
Comment (by Darrel O'Pry):
Thanks for the feedback. I'm sorry but I'm not interested in yet another a
login on yet another site.
--
Ticket URL: <https://code.djangoproject.com/ticket/34575#comment:3>