Commit 834afe79 authored by Stefan H. Holek's avatar Stefan H. Holek

Collector #2307: ObjectCopiedEvent not dispatched to sublocations.

parent c9b7a721
......@@ -8,6 +8,8 @@ Zope Changes
Bugs fixed
- Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
- Collector #2304: fixed markup issue in ptEdit.zpt
- Collector #2260: fixed Examples.zexp
......
......@@ -31,6 +31,7 @@ import zope.interface
import zope.location.interfaces
from zope.app.container.contained import dispatchToSublocations
from zope.app.container.interfaces import IObjectMovedEvent
from zope.lifecycleevent.interfaces import IObjectCopiedEvent
deprecatedManageAddDeleteClasses = []
......@@ -130,6 +131,14 @@ def dispatchObjectClonedEvent(ob, event):
if OFS.interfaces.IObjectManager.providedBy(ob):
dispatchToSublocations(ob, event)
@zope.component.adapter(OFS.interfaces.IItem, IObjectCopiedEvent)
def dispatchObjectCopiedEvent(ob, event):
"""Multi-subscriber for IItem + IObjectCopiedEvent.
"""
# Dispatch to sublocations
if OFS.interfaces.IObjectManager.providedBy(ob):
dispatchToSublocations(ob, event)
def callManageAfterAdd(ob, item, container):
"""Compatibility subscriber for manage_afterAdd.
......
......@@ -224,7 +224,7 @@ class TestCopySupportSublocation(EventTest):
self.subfolder.manage_clone(self.folder.myfolder, 'myfolder')
self.assertEqual(eventlog.called(),
[('myfolder', 'ObjectCopiedEvent'),
#('mydoc', 'ObjectCopiedEvent'),
('mydoc', 'ObjectCopiedEvent'),
('myfolder', 'ObjectWillBeAddedEvent'),
('mydoc', 'ObjectWillBeAddedEvent'),
('myfolder', 'ObjectAddedEvent'),
......@@ -240,7 +240,7 @@ class TestCopySupportSublocation(EventTest):
self.subfolder.manage_pasteObjects(cb)
self.assertEqual(eventlog.called(),
[('myfolder', 'ObjectCopiedEvent'),
#('mydoc', 'ObjectCopiedEvent'),
('mydoc', 'ObjectCopiedEvent'),
('myfolder', 'ObjectWillBeAddedEvent'),
('mydoc', 'ObjectWillBeAddedEvent'),
('myfolder', 'ObjectAddedEvent'),
......@@ -282,7 +282,7 @@ class TestCopySupportSublocation(EventTest):
self.folder.myfolder.COPY(req, req.RESPONSE)
self.assertEqual(eventlog.called(),
[('myfolder', 'ObjectCopiedEvent'),
#('mydoc', 'ObjectCopiedEvent'),
('mydoc', 'ObjectCopiedEvent'),
('myfolder', 'ObjectWillBeAddedEvent'),
('mydoc', 'ObjectWillBeAddedEvent'),
('myfolder', 'ObjectAddedEvent'),
......
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