From a2eaf8b6d441f6dafeb5d4fd6226edcc40f0896b Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Fri, 3 Jul 2015 17:52:58 +0200 Subject: [PATCH] Add folder_updated signal --- indico/core/signals/attachments.py | 7 +++++++ indico/modules/attachments/controllers/management/base.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/indico/core/signals/attachments.py b/indico/core/signals/attachments.py index 913eecfec..8574b35c2 100644 --- a/indico/core/signals/attachments.py +++ b/indico/core/signals/attachments.py @@ -34,6 +34,13 @@ Called when a folder is deleted. The *sender* is the is passed in the `user` kwarg. """) +folder_updated = _signals.signal('folder-updated', """ +Called when a folder is updated. The *sender* is the +`AttachmentFolder` that was updated. The user who updated the folder +is passed in the `user` kwarg. +""") + + attachment_created = _signals.signal('attachment-created', """ Called when a new attachment is created. The *sender* object is the new `Attachment`. The user who created the attachment is passed in diff --git a/indico/modules/attachments/controllers/management/base.py b/indico/modules/attachments/controllers/management/base.py index 4ccb14ce6..b1e4ef7f0 100644 --- a/indico/modules/attachments/controllers/management/base.py +++ b/indico/modules/attachments/controllers/management/base.py @@ -152,6 +152,8 @@ class EditFolderMixin(SpecificFolderMixin): form.populate_obj(self.folder, skip={'acl'}) if self.folder.is_protected: self.folder.acl = form.acl.data + logger.info('Folder {} updated by {}'.format(self.folder, session.user)) + signals.attachments.folder_updated.send(self.folder, user=session.user) flash(_("Folder \"{name}\" updated").format(name=self.folder.title), 'success') return jsonify_data(attachment_list=_render_attachment_list(self.object)) return jsonify_template('attachments/create_folder.html', form=form) -- 2.11.4.GIT