Updated subscribers interface
authorThierry Florac <thierry.florac@onf.fr>
Fri, 10 Nov 2017 11:56:04 +0100
changeset 255 38133975088e
parent 254 eadd658a8416
child 256 8e2207197a9a
Updated subscribers interface
src/pyams_content/component/association/__init__.py
--- a/src/pyams_content/component/association/__init__.py	Fri Nov 10 11:55:35 2017 +0100
+++ b/src/pyams_content/component/association/__init__.py	Fri Nov 10 11:56:04 2017 +0100
@@ -16,8 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationItem
-from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_content.component.association.interfaces import IAssociationItem, IAssociationTarget
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
 
@@ -53,14 +52,14 @@
 
     @property
     def edit_permission(self):
-        content = get_parent(self.context, IWfSharedContent)
+        content = get_parent(self.context, IAssociationTarget)
         return IFormContextPermissionChecker(content).edit_permission
 
 
 @subscriber(IObjectAddedEvent, context_selector=IAssociationItem)
 def handle_added_association(event):
     """Handle added association item"""
-    content = get_parent(event.object, IWfSharedContent)
+    content = get_parent(event.object, IAssociationTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))
 
@@ -68,7 +67,7 @@
 @subscriber(IObjectModifiedEvent, context_selector=IAssociationItem)
 def handle_modified_association(event):
     """Handle modified association item"""
-    content = get_parent(event.object, IWfSharedContent)
+    content = get_parent(event.object, IAssociationTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))
 
@@ -76,6 +75,6 @@
 @subscriber(IObjectRemovedEvent, context_selector=IAssociationItem)
 def handle_removed_association(event):
     """Handle removed association item"""
-    content = get_parent(event.object, IWfSharedContent)
+    content = get_parent(event.object, IAssociationTarget)
     if content is not None:
         get_current_registry().notify(ObjectModifiedEvent(content))