Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ec9dd198
Commit
ec9dd198
authored
Apr 09, 2007
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
parent
46209156
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
3 deletions
+24
-3
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/OFS/subscribers.py
lib/python/OFS/subscribers.py
+9
-0
lib/python/OFS/tests/testCopySupportEvents.py
lib/python/OFS/tests/testCopySupportEvents.py
+3
-3
lib/python/Products/Five/event.zcml
lib/python/Products/Five/event.zcml
+3
-0
lib/python/Products/Five/tests/event.txt
lib/python/Products/Five/tests/event.txt
+7
-0
No files found.
doc/CHANGES.txt
View file @
ec9dd198
...
@@ -91,6 +91,8 @@ Zope Changes
...
@@ -91,6 +91,8 @@ Zope Changes
Bugs Fixed
Bugs Fixed
- Collector #2307: ObjectCopiedEvent not dispatched to sublocations.
- Collector #2298: webdav.Resource.COPY and webdav.Resource.MOVE did
- Collector #2298: webdav.Resource.COPY and webdav.Resource.MOVE did
not send the expected copy/move events.
not send the expected copy/move events.
...
...
lib/python/OFS/subscribers.py
View file @
ec9dd198
...
@@ -31,6 +31,7 @@ import zope.interface
...
@@ -31,6 +31,7 @@ import zope.interface
import
zope.location.interfaces
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
from
zope.app.container.interfaces
import
IObjectMovedEvent
from
zope.lifecycleevent.interfaces
import
IObjectCopiedEvent
deprecatedManageAddDeleteClasses
=
[]
deprecatedManageAddDeleteClasses
=
[]
...
@@ -130,6 +131,14 @@ def dispatchObjectClonedEvent(ob, event):
...
@@ -130,6 +131,14 @@ def dispatchObjectClonedEvent(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
,
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
):
def
callManageAfterAdd
(
ob
,
item
,
container
):
"""Compatibility subscriber for manage_afterAdd.
"""Compatibility subscriber for manage_afterAdd.
...
...
lib/python/OFS/tests/testCopySupportEvents.py
View file @
ec9dd198
...
@@ -275,7 +275,7 @@ class TestCopySupportSublocation(EventTest):
...
@@ -275,7 +275,7 @@ class TestCopySupportSublocation(EventTest):
# Test clone
# Test clone
self
.
subfolder
.
manage_clone
(
self
.
folder
.
myfolder
,
'myfolder'
)
self
.
subfolder
.
manage_clone
(
self
.
folder
.
myfolder
,
'myfolder'
)
self
.
assertEqual
(
eventlog
.
called
(),
self
.
assertEqual
(
eventlog
.
called
(),
[
#
('mydoc', 'ObjectCopiedEvent'),
[(
'mydoc'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
...
@@ -291,7 +291,7 @@ class TestCopySupportSublocation(EventTest):
...
@@ -291,7 +291,7 @@ class TestCopySupportSublocation(EventTest):
cb
=
self
.
folder
.
manage_copyObjects
([
'myfolder'
])
cb
=
self
.
folder
.
manage_copyObjects
([
'myfolder'
])
self
.
subfolder
.
manage_pasteObjects
(
cb
)
self
.
subfolder
.
manage_pasteObjects
(
cb
)
self
.
assertEqual
(
eventlog
.
called
(),
self
.
assertEqual
(
eventlog
.
called
(),
[
#
('mydoc', 'ObjectCopiedEvent'),
[(
'mydoc'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
...
@@ -333,7 +333,7 @@ class TestCopySupportSublocation(EventTest):
...
@@ -333,7 +333,7 @@ class TestCopySupportSublocation(EventTest):
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/myfolder'
%
self
.
folder
.
absolute_url
()
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/myfolder'
%
self
.
folder
.
absolute_url
()
self
.
folder
.
myfolder
.
COPY
(
req
,
req
.
RESPONSE
)
self
.
folder
.
myfolder
.
COPY
(
req
,
req
.
RESPONSE
)
self
.
assertEqual
(
eventlog
.
called
(),
self
.
assertEqual
(
eventlog
.
called
(),
[
#
('mydoc', 'ObjectCopiedEvent'),
[(
'mydoc'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'myfolder'
,
'ObjectCopiedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'mydoc'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
(
'myfolder'
,
'ObjectWillBeAddedEvent'
),
...
...
lib/python/Products/Five/event.zcml
View file @
ec9dd198
...
@@ -16,4 +16,7 @@
...
@@ -16,4 +16,7 @@
<!-- dispatch IObjectClonedEvent with "top-down" semantics -->
<!-- dispatch IObjectClonedEvent with "top-down" semantics -->
<subscriber handler="OFS.subscribers.dispatchObjectClonedEvent" />
<subscriber handler="OFS.subscribers.dispatchObjectClonedEvent" />
<!-- dispatch IObjectCopiedEvent with "top-down" semantics -->
<subscriber handler="OFS.subscribers.dispatchObjectCopiedEvent" />
</configure>
</configure>
lib/python/Products/Five/tests/event.txt
View file @
ec9dd198
...
@@ -57,6 +57,7 @@ printed events will be in their "natural" order::
...
@@ -57,6 +57,7 @@ printed events will be in their "natural" order::
>>> from zope.component.interfaces import IObjectEvent, IRegistrationEvent
>>> from zope.component.interfaces import IObjectEvent, IRegistrationEvent
>>> from zope.app.container.interfaces import IObjectMovedEvent
>>> from zope.app.container.interfaces import IObjectMovedEvent
>>> from zope.lifecycleevent.interfaces import IObjectCopiedEvent
>>> from OFS.interfaces import IObjectWillBeMovedEvent
>>> from OFS.interfaces import IObjectWillBeMovedEvent
>>> from OFS.interfaces import IObjectClonedEvent
>>> from OFS.interfaces import IObjectClonedEvent
>>> from OFS.interfaces import IItem
>>> from OFS.interfaces import IItem
...
@@ -64,6 +65,7 @@ printed events will be in their "natural" order::
...
@@ -64,6 +65,7 @@ printed events will be in their "natural" order::
... print event.__class__.__name__, object.getId()
... print event.__class__.__name__, object.getId()
>>> def printObjectEventExceptSome(object, event):
>>> def printObjectEventExceptSome(object, event):
... if (IObjectMovedEvent.providedBy(event) or
... if (IObjectMovedEvent.providedBy(event) or
... IObjectCopiedEvent.providedBy(event) or
... IObjectWillBeMovedEvent.providedBy(event) or
... IObjectWillBeMovedEvent.providedBy(event) or
... IObjectClonedEvent.providedBy(event) or
... IObjectClonedEvent.providedBy(event) or
... IRegistrationEvent.providedBy(event)):
... IRegistrationEvent.providedBy(event)):
...
@@ -72,6 +74,7 @@ printed events will be in their "natural" order::
...
@@ -72,6 +74,7 @@ printed events will be in their "natural" order::
>>> from zope.component import provideHandler
>>> from zope.component import provideHandler
>>> provideHandler(printObjectEvent, (IItem, IObjectMovedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectMovedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectCopiedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectWillBeMovedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectWillBeMovedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectClonedEvent))
>>> provideHandler(printObjectEvent, (IItem, IObjectClonedEvent))
>>> provideHandler(printObjectEventExceptSome, (None, IObjectEvent))
>>> provideHandler(printObjectEventExceptSome, (None, IObjectEvent))
...
@@ -83,6 +86,7 @@ Finally we need to load the subscribers configuration::
...
@@ -83,6 +86,7 @@ Finally we need to load the subscribers configuration::
>>> zope.component.provideAdapter(OFS.subscribers.ObjectManagerSublocations)
>>> zope.component.provideAdapter(OFS.subscribers.ObjectManagerSublocations)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectWillBeMovedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectWillBeMovedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectMovedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectMovedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectCopiedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectClonedEvent)
>>> zope.component.provideHandler(OFS.subscribers.dispatchObjectClonedEvent)
We need at least one fake deprecated method to tell the compatibility
We need at least one fake deprecated method to tell the compatibility
...
@@ -133,6 +137,7 @@ Same thing for clone::
...
@@ -133,6 +137,7 @@ Same thing for clone::
>>> res = folder.manage_clone(folder.marine, 'tank')
>>> res = folder.manage_clone(folder.marine, 'tank')
ObjectCopiedEvent tank
ObjectCopiedEvent tank
ObjectCopiedEvent dog
ObjectWillBeAddedEvent tank
ObjectWillBeAddedEvent tank
ObjectWillBeAddedEvent dog
ObjectWillBeAddedEvent dog
ObjectAddedEvent tank
ObjectAddedEvent tank
...
@@ -282,6 +287,7 @@ Cloning a tree of objects::
...
@@ -282,6 +287,7 @@ Cloning a tree of objects::
>>> res = folder.manage_clone(folder.pluto, 'mickey')
>>> res = folder.manage_clone(folder.pluto, 'mickey')
ObjectCopiedEvent mickey
ObjectCopiedEvent mickey
ObjectCopiedEvent donald
ObjectWillBeAddedEvent mickey
ObjectWillBeAddedEvent mickey
ObjectWillBeAddedEvent donald
ObjectWillBeAddedEvent donald
ObjectAddedEvent mickey
ObjectAddedEvent mickey
...
@@ -414,6 +420,7 @@ Cloning a tree of objects::
...
@@ -414,6 +420,7 @@ Cloning a tree of objects::
>>> res = folder.manage_clone(folder.firefly, 'serenity')
>>> res = folder.manage_clone(folder.firefly, 'serenity')
ObjectCopiedEvent serenity
ObjectCopiedEvent serenity
ObjectCopiedEvent mel
ObjectWillBeAddedEvent serenity
ObjectWillBeAddedEvent serenity
ObjectWillBeAddedEvent mel
ObjectWillBeAddedEvent mel
ObjectAddedEvent serenity
ObjectAddedEvent serenity
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment