add adapter() declarations so that these are easier to register

parent d4df2441
...@@ -21,17 +21,17 @@ import warnings ...@@ -21,17 +21,17 @@ import warnings
import sys import sys
from logging import getLogger from logging import getLogger
import OFS.interfaces
from Acquisition import aq_base from Acquisition import aq_base
from App.config import getConfiguration from App.config import getConfiguration
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import OFS.interfaces
from zope.interface import implements import zope.component
from zope.component import adapts import zope.interface
from zope.location.interfaces import ISublocations import zope.location.interfaces
from zope.app.container.contained import dispatchToSublocations from zope.app.container.contained import dispatchToSublocations
from zope.app.container.interfaces import IObjectMovedEvent
deprecatedManageAddDeleteClasses = [] deprecatedManageAddDeleteClasses = []
...@@ -79,8 +79,8 @@ def maybeWarnDeprecated(ob, method_name): ...@@ -79,8 +79,8 @@ def maybeWarnDeprecated(ob, method_name):
class ObjectManagerSublocations(object): class ObjectManagerSublocations(object):
"""Get the sublocations for an ObjectManager. """Get the sublocations for an ObjectManager.
""" """
adapts(OFS.interfaces.IObjectManager) zope.component.adapts(OFS.interfaces.IObjectManager)
implements(ISublocations) zope.interface.implements(zope.location.interfaces.ISublocations)
def __init__(self, container): def __init__(self, container):
self.container = container self.container = container
...@@ -99,6 +99,8 @@ class ObjectManagerSublocations(object): ...@@ -99,6 +99,8 @@ class ObjectManagerSublocations(object):
# could have a simple subscriber for IObjectManager that directly calls # could have a simple subscriber for IObjectManager that directly calls
# dispatchToSublocations. # dispatchToSublocations.
@zope.component.adapter(OFS.interfaces.IItem,
OFS.interfaces.IObjectWillBeMovedEvent)
def dispatchObjectWillBeMovedEvent(ob, event): def dispatchObjectWillBeMovedEvent(ob, event):
"""Multi-subscriber for IItem + IObjectWillBeMovedEvent. """Multi-subscriber for IItem + IObjectWillBeMovedEvent.
""" """
...@@ -108,6 +110,7 @@ def dispatchObjectWillBeMovedEvent(ob, event): ...@@ -108,6 +110,7 @@ def dispatchObjectWillBeMovedEvent(ob, event):
# Next, do the manage_beforeDelete dance # Next, do the manage_beforeDelete dance
callManageBeforeDelete(ob, event.object, event.oldParent) callManageBeforeDelete(ob, event.object, event.oldParent)
@zope.component.adapter(OFS.interfaces.IItem, IObjectMovedEvent)
def dispatchObjectMovedEvent(ob, event): def dispatchObjectMovedEvent(ob, event):
"""Multi-subscriber for IItem + IObjectMovedEvent. """Multi-subscriber for IItem + IObjectMovedEvent.
""" """
...@@ -117,6 +120,8 @@ def dispatchObjectMovedEvent(ob, event): ...@@ -117,6 +120,8 @@ def dispatchObjectMovedEvent(ob, event):
if OFS.interfaces.IObjectManager.providedBy(ob): if OFS.interfaces.IObjectManager.providedBy(ob):
dispatchToSublocations(ob, event) dispatchToSublocations(ob, event)
@zope.component.adapter(OFS.interfaces.IItem,
OFS.interfaces.IObjectClonedEvent)
def dispatchObjectClonedEvent(ob, event): def dispatchObjectClonedEvent(ob, event):
"""Multi-subscriber for IItem + IObjectClonedEvent. """Multi-subscriber for IItem + IObjectClonedEvent.
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment