Moved events subscribers to ".media" sub-module
authorThierry Florac <thierry.florac@onf.fr>
Thu, 21 Apr 2016 18:11:50 +0200
changeset 23 1c0bac23c875
parent 22 c270ea8f041e
child 24 b5882159dea4
Moved events subscribers to ".media" sub-module
src/pyams_content/component/gallery/__init__.py
--- a/src/pyams_content/component/gallery/__init__.py	Thu Apr 21 18:11:18 2016 +0200
+++ b/src/pyams_content/component/gallery/__init__.py	Thu Apr 21 18:11:50 2016 +0200
@@ -18,7 +18,6 @@
 # import interfaces
 from pyams_content.component.gallery.interfaces import IGalleryFileInfo, GALLERY_FILE_INFO_KEY, IGallery, IGalleryFile
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_file.interfaces import IMediaFile
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from pyams_i18n.interfaces import II18n
 from zope.annotation.interfaces import IAnnotations
@@ -102,30 +101,6 @@
         return IFormContextPermissionChecker(content).edit_permission
 
 
-@subscriber(IObjectAddedEvent, context_selector=IMediaFile)
-def handle_added_media(event):
-    """Handle added media file"""
-    content = get_parent(event.object, IWfSharedContent)
-    if content is not None:
-        get_current_registry().notify(ObjectModifiedEvent(content))
-
-
-@subscriber(IObjectModifiedEvent, context_selector=IMediaFile)
-def handle_modified_media(event):
-    """Handle modified media file"""
-    content = get_parent(event.object, IWfSharedContent)
-    if content is not None:
-        get_current_registry().notify(ObjectModifiedEvent(content))
-
-
-@subscriber(IObjectRemovedEvent, context_selector=IMediaFile)
-def handle_removed_media(event):
-    """Handle removed media file"""
-    content = get_parent(event.object, IWfSharedContent)
-    if content is not None:
-        get_current_registry().notify(ObjectModifiedEvent(content))
-
-
 #
 # Gallery
 #