[Django] #34575: Storage Signals

7 views
Skip to first unread message

Django

unread,
May 18, 2023, 9:50:54 AM5/18/23
to django-...@googlegroups.com
#34575: Storage Signals
-----------------------------------------+------------------------
Reporter: dopry | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
It would be nice if Storage emitted signals on file operations, so file
related processes can be implemented without tight coupling.

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.

Django

unread,
May 18, 2023, 9:53:23 AM5/18/23
to django-...@googlegroups.com
#34575: Storage Signals
-------------------------------------+-------------------------------------
Reporter: Darrel O'Pry | Owner: nobody
Type: New feature | Status: new
Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution:
Keywords: storage signals | Triage Stage:

| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Darrel O'Pry):

* 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>

Django

unread,
May 18, 2023, 12:58:27 PM5/18/23
to django-...@googlegroups.com
#34575: Storage Signals
-------------------------------------+-------------------------------------
Reporter: Darrel O'Pry | Owner: nobody
Type: New feature | Status: closed

Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution: wontfix

Keywords: storage signals | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* 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>

Django

unread,
May 18, 2023, 5:27:04 PM5/18/23
to django-...@googlegroups.com
#34575: Storage Signals
-------------------------------------+-------------------------------------
Reporter: Darrel O'Pry | Owner: nobody
Type: New feature | Status: closed
Component: File | Version: 4.2
uploads/storage |
Severity: Normal | Resolution: wontfix
Keywords: storage signals | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Reply all
Reply to author
Forward
0 new messages