[z3-checkins] r19416 - in z3/Five/branch/Five-1.2: . bbb tests
efge at codespeak.net
efge at codespeak.net
Wed Nov 2 16:18:34 CET 2005
Author: efge
Date: Wed Nov 2 16:18:34 2005
New Revision: 19416
Added:
z3/Five/branch/Five-1.2/bbb/OFS_event.py (contents, props changed)
z3/Five/branch/Five-1.2/bbb/OFS_subscribers.py (contents, props changed)
Removed:
z3/Five/branch/Five-1.2/subscribers.py
Modified:
z3/Five/branch/Five-1.2/bbb/OFS_interfaces.py
z3/Five/branch/Five-1.2/event.py
z3/Five/branch/Five-1.2/event.zcml
z3/Five/branch/Five-1.2/eventconfigure.py
z3/Five/branch/Five-1.2/interfaces.py
z3/Five/branch/Five-1.2/tests/event.txt
Log:
Move code around, to keep in sync with Five 1.3 layout where a lot of
the code was actually moved to the OFS package.
Renamed FiveObjectCopiedEvent to ObjectCopiedEvent.
Added: z3/Five/branch/Five-1.2/bbb/OFS_event.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/Five-1.2/bbb/OFS_event.py Wed Nov 2 16:18:34 2005
@@ -0,0 +1,61 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+OFS event definitions.
+
+$Id$
+"""
+
+from zope.interface import implements
+from zope.app.event.objectevent import ObjectEvent
+import OFS_interfaces
+
+class ObjectWillBeMovedEvent(ObjectEvent):
+ """An object will be moved."""
+ implements(OFS_interfaces.IObjectWillBeMovedEvent)
+
+ def __init__(self, object, oldParent, oldName, newParent, newName):
+ ObjectEvent.__init__(self, object)
+ self.oldParent = oldParent
+ self.oldName = oldName
+ self.newParent = newParent
+ self.newName = newName
+
+class ObjectWillBeAddedEvent(ObjectWillBeMovedEvent):
+ """An object will be added to a container."""
+ implements(OFS_interfaces.IObjectWillBeAddedEvent)
+
+ def __init__(self, object, newParent=None, newName=None):
+ #if newParent is None:
+ # newParent = object.__parent__
+ #if newName is None:
+ # newName = object.__name__
+ ObjectWillBeMovedEvent.__init__(self, object, None, None,
+ newParent, newName)
+
+class ObjectWillBeRemovedEvent(ObjectWillBeMovedEvent):
+ """An object will be removed from a container."""
+ implements(OFS_interfaces.IObjectWillBeRemovedEvent)
+
+ def __init__(self, object, oldParent=None, oldName=None):
+ #if oldParent is None:
+ # oldParent = object.__parent__
+ #if oldName is None:
+ # oldName = object.__name__
+ ObjectWillBeMovedEvent.__init__(self, object, oldParent, oldName,
+ None, None)
+
+class ObjectClonedEvent(ObjectEvent):
+ """An object has been cloned into a container."""
+ implements(OFS_interfaces.IObjectClonedEvent)
Modified: z3/Five/branch/Five-1.2/bbb/OFS_interfaces.py
==============================================================================
--- z3/Five/branch/Five-1.2/bbb/OFS_interfaces.py (original)
+++ z3/Five/branch/Five-1.2/bbb/OFS_interfaces.py Wed Nov 2 16:18:34 2005
@@ -739,3 +739,33 @@
"""Check the global (zclass) registry for problems, which can
be caused by things like disk-based products being deleted.
Return true if a problem is found"""
+
+
+##################################################
+# Event interfaces
+
+from zope.app.event.interfaces import IObjectEvent
+
+class IObjectWillBeMovedEvent(IObjectEvent):
+ """An object will be moved."""
+ oldParent = Attribute("The old location parent for the object.")
+ oldName = Attribute("The old location name for the object.")
+ newParent = Attribute("The new location parent for the object.")
+ newName = Attribute("The new location name for the object.")
+
+class IObjectWillBeAddedEvent(IObjectWillBeMovedEvent):
+ """An object will be added to a container."""
+
+class IObjectWillBeRemovedEvent(IObjectWillBeMovedEvent):
+ """An object will be removed from a container"""
+
+class IObjectClonedEvent(IObjectEvent):
+ """An object has been cloned (a la Zope 2).
+
+ This is for Zope 2 compatibility, subscribers should really use
+ IObjectCopiedEvent or IObjectAddedEvent, depending on their use
+ cases.
+
+ event.object is the copied object, already added to its container.
+ Note that this event is dispatched to all sublocations.
+ """
Added: z3/Five/branch/Five-1.2/bbb/OFS_subscribers.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/Five-1.2/bbb/OFS_subscribers.py Wed Nov 2 16:18:34 2005
@@ -0,0 +1,154 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+Five subscriber definitions.
+
+$Id$
+"""
+
+##################################################
+
+import sys
+from zLOG import LOG, ERROR
+from App.config import getConfiguration
+from AccessControl import getSecurityManager
+from ZODB.POSException import ConflictError
+from OFS.ObjectManager import BeforeDeleteException
+from Products.Five.fiveconfigure import isFiveMethod
+from zope.app.container.contained import dispatchToSublocations
+from OFS_interfaces import IObjectManager
+
+
+deprecatedManageAddDeleteClasses = []
+
+
+def hasDeprecatedMethods(ob):
+ """Do we need to call the deprecated methods?
+ """
+ for class_ in deprecatedManageAddDeleteClasses:
+ if isinstance(ob, class_):
+ return True
+ return False
+
+def maybeCallDeprecated(method_name, ob, *args):
+ """Call a deprecated method, if the framework doesn't call it already.
+ """
+ if hasDeprecatedMethods(ob):
+ # Already deprecated through zcml
+ return
+ method = getattr(ob, method_name)
+ if isFiveMethod(method):
+ # Monkey-patched method
+ return
+ if deprecatedManageAddDeleteClasses:
+ # Not deprecated through zcml and directives fully loaded
+ class_ = ob.__class__
+ warnings.warn(
+ "Calling %s.%s.%s is deprecated when using Five, "
+ "instead use event subscribers or "
+ "mark the class with <five:deprecatedManageAddDelete/>"
+ % (class_.__module__, class_.__name__, method_name),
+ DeprecationWarning)
+ # Note that calling the method can lead to incorrect behavior
+ # but in the most common case that's better than not calling it.
+ method(ob, *args)
+
+
+##################################################
+# Adapters and subscribers
+
+class ObjectManagerSublocations(object):
+ """Get the sublocations for an ObjectManager.
+ """
+ def __init__(self, container):
+ self.container = container
+
+ def sublocations(self):
+ for ob in self.container.objectValues():
+ yield ob
+
+# The following subscribers should really be defined in ZCML
+# but we don't have enough control over subscriber ordering for
+# that to work exactly right.
+# (Sometimes IItem comes before IObjectManager, sometimes after,
+# depending on some of Zope's classes.)
+# This code can be simplified when Zope is completely rid of
+# manage_afterAdd & co, then IItem wouldn't be relevant anymore and we
+# could have a simple subscriber for IObjectManager that directly calls
+# dispatchToSublocations.
+
+def dispatchObjectWillBeMovedEvent(ob, event):
+ """Multi-subscriber for IItem + IObjectWillBeMovedEvent.
+ """
+ # First, dispatch to sublocations
+ if IObjectManager.providedBy(ob):
+ dispatchToSublocations(ob, event)
+ # Next, do the manage_beforeDelete dance
+ if hasDeprecatedMethods(ob):
+ callManageBeforeDelete(ob, event)
+
+def dispatchObjectMovedEvent(ob, event):
+ """Multi-subscriber for IItem + IObjectMovedEvent.
+ """
+ # First, do the manage_afterAdd dance
+ if hasDeprecatedMethods(ob):
+ callManageAfterAdd(ob, event)
+ # Next, dispatch to sublocations
+ if IObjectManager.providedBy(ob):
+ dispatchToSublocations(ob, event)
+
+def dispatchObjectClonedEvent(ob, event):
+ """Multi-subscriber for IItem + IObjectClonedEvent.
+ """
+ # First, do the manage_afterClone dance
+ if hasDeprecatedMethods(ob):
+ callManageAfterClone(ob, event)
+ # Next, dispatch to sublocations
+ if IObjectManager.providedBy(ob):
+ dispatchToSublocations(ob, event)
+
+
+def callManageAfterAdd(ob, event):
+ """Compatibility subscriber for manage_afterAdd.
+ """
+ container = event.newParent
+ if container is None:
+ # this is a remove
+ return
+ ob.manage_afterAdd(event.object, container)
+
+def callManageBeforeDelete(ob, event):
+ """Compatibility subscriber for manage_beforeDelete.
+ """
+ container = event.oldParent
+ if container is None:
+ # this is an add
+ return
+ try:
+ ob.manage_beforeDelete(event.object, container)
+ except BeforeDeleteException:
+ raise
+ except ConflictError:
+ raise
+ except:
+ LOG('Zope', ERROR, '_delObject() threw', error=sys.exc_info())
+ # In debug mode when non-Manager, let exceptions propagate.
+ if getConfiguration().debug_mode:
+ if not getSecurityManager().getUser().has_role('Manager'):
+ raise
+
+def callManageAfterClone(ob, event):
+ """Compatibility subscriber for manage_afterClone.
+ """
+ ob.manage_afterClone(event.object)
Modified: z3/Five/branch/Five-1.2/event.py
==============================================================================
--- z3/Five/branch/Five-1.2/event.py (original)
+++ z3/Five/branch/Five-1.2/event.py Wed Nov 2 16:18:34 2005
@@ -12,242 +12,43 @@
#
##############################################################################
"""
-Five event definitions.
-
-May eventually be folded back into Zope 3 proper.
+Five event monkey patches.
$Id$
"""
import warnings
-
-from zope.event import notify
-from zope.interface import implements
-from zope.interface import Attribute
-
-from zope.app.event.interfaces import IObjectEvent
-from zope.app.container.interfaces import IObjectAddedEvent
-from zope.app.container.interfaces import IObjectRemovedEvent
-
-from zope.app.event.objectevent import ObjectEvent
-from zope.app.container.contained import ObjectMovedEvent
-from zope.app.container.contained import ObjectAddedEvent
-from zope.app.container.contained import ObjectRemovedEvent
-from zope.app.event.objectevent import ObjectCopiedEvent
-from zope.app.container.contained import dispatchToSublocations
-
-from Products.Five.fiveconfigure import isFiveMethod
-
-
-class IObjectWillBeMovedEvent(IObjectEvent):
- """An object will be moved."""
- oldParent = Attribute("The old location parent for the object.")
- oldName = Attribute("The old location name for the object.")
- newParent = Attribute("The new location parent for the object.")
- newName = Attribute("The new location name for the object.")
-
-class IObjectWillBeAddedEvent(IObjectWillBeMovedEvent):
- """An object will be added to a container."""
-
-class IObjectWillBeRemovedEvent(IObjectWillBeMovedEvent):
- """An object will be removed from a container"""
-
-class IFiveObjectClonedEvent(IObjectEvent):
- """An object has been cloned (a la Zope 2).
-
- This is for Zope 2 compatibility, subscribers should really use
- IObjectCopiedEvent or IObjectAddedEvent, depending on their use
- cases.
-
- event.object is the copied object, already added to its container.
- Note that this event is dispatched to all sublocations.
- """
-
-
-class ObjectWillBeMovedEvent(ObjectEvent):
- """An object will be moved"""
- implements(IObjectWillBeMovedEvent)
-
- def __init__(self, object, oldParent, oldName, newParent, newName):
- ObjectEvent.__init__(self, object)
- self.oldParent = oldParent
- self.oldName = oldName
- self.newParent = newParent
- self.newName = newName
-
-class ObjectWillBeAddedEvent(ObjectWillBeMovedEvent):
- """An object will be added to a container"""
- implements(IObjectWillBeAddedEvent)
-
- def __init__(self, object, newParent=None, newName=None):
- #if newParent is None:
- # newParent = object.__parent__
- #if newName is None:
- # newName = object.__name__
- ObjectWillBeMovedEvent.__init__(self, object, None, None,
- newParent, newName)
-
-class ObjectWillBeRemovedEvent(ObjectWillBeMovedEvent):
- """An object will be removed from a container"""
- implements(IObjectWillBeRemovedEvent)
-
- def __init__(self, object, oldParent=None, oldName=None):
- #if oldParent is None:
- # oldParent = object.__parent__
- #if oldName is None:
- # oldName = object.__name__
- ObjectWillBeMovedEvent.__init__(self, object, oldParent, oldName,
- None, None)
-
-class FiveObjectClonedEvent(ObjectEvent):
- implements(IFiveObjectClonedEvent)
-
-
-##################################################
-
import sys
from cgi import escape
-from zLOG import LOG, ERROR
from Acquisition import aq_base, aq_parent, aq_inner
-from App.config import getConfiguration
from App.Dialogs import MessageDialog
from AccessControl import getSecurityManager
from ZODB.POSException import ConflictError
-from OFS.ObjectManager import BeforeDeleteException
from OFS import Moniker
from OFS.CopySupport import CopyError # Yuck, a string exception
from OFS.CopySupport import eNoData, eNotFound, eInvalid, eNotSupported
from OFS.CopySupport import cookie_path, sanity_check, _cb_decode
from webdav.Lockable import ResourceLockedError
-FIVE_ORIGINAL_PREFIX = '__five_original_'
-
-
-hasContainerEvents = False
-deprecatedManageAddDeleteClasses = []
-
-
-def hasDeprecatedMethods(ob):
- """Do we need to call the deprecated methods?
- """
- for class_ in deprecatedManageAddDeleteClasses:
- if isinstance(ob, class_):
- return True
- return False
-
-def maybeCallDeprecated(method_name, ob, *args):
- """Call a deprecated method, if the framework doesn't call it already.
- """
- if hasDeprecatedMethods(ob):
- # Already deprecated through zcml
- return
- method = getattr(ob, method_name)
- if isFiveMethod(method):
- # Monkey-patched method
- return
- if deprecatedManageAddDeleteClasses:
- # Not deprecated through zcml and directives fully loaded
- class_ = ob.__class__
- warnings.warn(
- "Calling %s.%s.%s is deprecated when using Five, "
- "instead use event subscribers or "
- "mark the class with <five:deprecatedManageAddDelete/>"
- % (class_.__module__, class_.__name__, method_name),
- DeprecationWarning)
- # Note that calling the method can lead to incorrect behavior
- # but in the most common case that's better than not calling it.
- method(ob, *args)
-
-
-##################################################
-# Adapters and subscribers
-
-from OFS.interfaces import IObjectManager
-
-class ObjectManagerSublocations(object):
- """Get the sublocations for an ObjectManager.
- """
- def __init__(self, container):
- self.container = container
-
- def sublocations(self):
- for ob in self.container.objectValues():
- yield ob
-
-# The following subscribers should really be defined in ZCML
-# but we don't have enough control over subscriber ordering for
-# that to work exactly right.
-# (Sometimes IItem comes before IObjectManager, sometimes after,
-# depending on some of Zope's classes.)
-# This code can be simplified when Zope is completely rid of
-# manage_afterAdd & co, then IItem wouldn't be relevant anymore and we
-# could have a simple subscriber for IObjectManager that directly calls
-# dispatchToSublocations.
-
-def dispatchObjectWillBeMovedEvent(ob, event):
- """Multi-subscriber for IItem + IObjectWillBeMovedEvent.
- """
- # First, dispatch to sublocations
- if IObjectManager.providedBy(ob):
- dispatchToSublocations(ob, event)
- # Next, do the manage_beforeDelete dance
- if hasDeprecatedMethods(ob):
- callManageBeforeDelete(ob, event)
-
-def dispatchObjectMovedEvent(ob, event):
- """Multi-subscriber for IItem + IObjectMovedEvent.
- """
- # First, do the manage_afterAdd dance
- if hasDeprecatedMethods(ob):
- callManageAfterAdd(ob, event)
- # Next, dispatch to sublocations
- if IObjectManager.providedBy(ob):
- dispatchToSublocations(ob, event)
-
-def dispatchFiveObjectClonedEvent(ob, event):
- """Multi-subscriber for IItem + IFiveObjectClonedEvent.
- """
- # First, do the manage_afterClone dance
- if hasDeprecatedMethods(ob):
- callManageAfterClone(ob, event)
- # Next, dispatch to sublocations
- if IObjectManager.providedBy(ob):
- dispatchToSublocations(ob, event)
+from zope.event import notify
+from zope.app.container.contained import ObjectMovedEvent
+from zope.app.container.contained import ObjectAddedEvent
+from zope.app.container.contained import ObjectRemovedEvent
+from zope.app.event.objectevent import ObjectCopiedEvent
+from OFS.event import ObjectWillBeMovedEvent
+from OFS.event import ObjectWillBeAddedEvent
+from OFS.event import ObjectWillBeRemovedEvent
+from OFS.event import ObjectClonedEvent
+from OFS.subscribers import deprecatedManageAddDeleteClasses
+from OFS.subscribers import hasDeprecatedMethods
+from OFS.subscribers import maybeCallDeprecated
+from Products.Five.fiveconfigure import isFiveMethod
-def callManageAfterAdd(ob, event):
- """Compatibility subscriber for manage_afterAdd.
- """
- container = event.newParent
- if container is None:
- # this is a remove
- return
- ob.manage_afterAdd(event.object, container)
-def callManageBeforeDelete(ob, event):
- """Compatibility subscriber for manage_beforeDelete.
- """
- container = event.oldParent
- if container is None:
- # this is an add
- return
- try:
- ob.manage_beforeDelete(event.object, container)
- except BeforeDeleteException:
- raise
- except ConflictError:
- raise
- except:
- LOG('Zope', ERROR, '_delObject() threw', error=sys.exc_info())
- # In debug mode when non-Manager, let exceptions propagate.
- if getConfiguration().debug_mode:
- if not getSecurityManager().getUser().has_role('Manager'):
- raise
+FIVE_ORIGINAL_PREFIX = '__five_original_'
-def callManageAfterClone(ob, event):
- """Compatibility subscriber for manage_afterClone.
- """
- ob.manage_afterClone(event.object)
+hasContainerEvents = False
##################################################
# Monkey patches
@@ -541,7 +342,7 @@
maybeCallDeprecated('manage_afterClone', ob)
- notify(FiveObjectClonedEvent(ob))
+ notify(ObjectClonedEvent(ob))
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1,
@@ -641,7 +442,7 @@
maybeCallDeprecated('manage_afterClone', ob)
- notify(FiveObjectClonedEvent(ob))
+ notify(ObjectClonedEvent(ob))
return ob
Modified: z3/Five/branch/Five-1.2/event.zcml
==============================================================================
--- z3/Five/branch/Five-1.2/event.zcml (original)
+++ z3/Five/branch/Five-1.2/event.zcml Wed Nov 2 16:18:34 2005
@@ -9,15 +9,15 @@
<adapter
for="OFS.interfaces.IObjectManager"
provides="zope.app.location.interfaces.ISublocations"
- factory=".subscribers.ObjectManagerSublocations"
+ factory="OFS.subscribers.ObjectManagerSublocations"
/>
<!-- dispatch IObjectWillBeMovedEvent with "bottom-up" semantics -->
<subscriber
for="OFS.interfaces.IItem
- .event.IObjectWillBeMovedEvent"
- factory=".subscribers.dispatchObjectWillBeMovedEvent"
+ OFS.interfaces.IObjectWillBeMovedEvent"
+ factory="OFS.subscribers.dispatchObjectWillBeMovedEvent"
/>
<!-- dispatch IObjectMovedEvent with "top-down" semantics -->
@@ -25,15 +25,15 @@
<subscriber
for="OFS.interfaces.IItem
zope.app.container.interfaces.IObjectMovedEvent"
- factory=".subscribers.dispatchObjectMovedEvent"
+ factory="OFS.subscribers.dispatchObjectMovedEvent"
/>
- <!-- dispatch IFiveObjectClonedEvent with "top-down" semantics -->
+ <!-- dispatch IObjectClonedEvent with "top-down" semantics -->
<subscriber
for="OFS.interfaces.IItem
- .event.IFiveObjectClonedEvent"
- factory=".subscribers.dispatchFiveObjectClonedEvent"
+ OFS.interfaces.IObjectClonedEvent"
+ factory="OFS.subscribers.dispatchObjectClonedEvent"
/>
</configure>
Modified: z3/Five/branch/Five-1.2/eventconfigure.py
==============================================================================
--- z3/Five/branch/Five-1.2/eventconfigure.py (original)
+++ z3/Five/branch/Five-1.2/eventconfigure.py Wed Nov 2 16:18:34 2005
@@ -19,7 +19,7 @@
"""
from Products.Five.event import doMonkies
-from Products.Five.event import deprecatedManageAddDeleteClasses
+from OFS.subscribers import deprecatedManageAddDeleteClasses
def setDeprecatedManageAddDelete(class_):
"""Instances of the class will still see their old methods called."""
Modified: z3/Five/branch/Five-1.2/interfaces.py
==============================================================================
--- z3/Five/branch/Five-1.2/interfaces.py (original)
+++ z3/Five/branch/Five-1.2/interfaces.py Wed Nov 2 16:18:34 2005
@@ -56,10 +56,14 @@
from Products.Five.bbb import Acquisition_interfaces
from Products.Five.bbb import App_interfaces
from Products.Five.bbb import OFS_interfaces
+ from Products.Five.bbb import OFS_event
+ from Products.Five.bbb import OFS_subscribers
from Products.Five.bbb import webdav_interfaces
sys.modules['AccessControl.interfaces'] = AccessControl_interfaces
sys.modules['Acquisition.interfaces'] = Acquisition_interfaces
sys.modules['App.interfaces'] = App_interfaces
sys.modules['OFS.interfaces'] = OFS_interfaces
+ sys.modules['OFS.event'] = OFS_event
+ sys.modules['OFS.subscribers'] = OFS_subscribers
sys.modules['webdav.interfaces'] = webdav_interfaces
Deleted: /z3/Five/branch/Five-1.2/subscribers.py
==============================================================================
--- /z3/Five/branch/Five-1.2/subscribers.py Wed Nov 2 16:18:34 2005
+++ (empty file)
@@ -1,25 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-Five subscriber definitions.
-
-$Id$
-"""
-# The following are imported here because it's their "official" place,
-# for Five 1.3 forward-compatibility.
-
-from Products.Five.event import ObjectManagerSublocations
-from Products.Five.event import dispatchObjectWillBeMovedEvent
-from Products.Five.event import dispatchObjectMovedEvent
-from Products.Five.event import dispatchFiveObjectClonedEvent
Modified: z3/Five/branch/Five-1.2/tests/event.txt
==============================================================================
--- z3/Five/branch/Five-1.2/tests/event.txt (original)
+++ z3/Five/branch/Five-1.2/tests/event.txt Wed Nov 2 16:18:34 2005
@@ -64,8 +64,8 @@
>>> from zope.app.event.interfaces import IObjectEvent
>>> from zope.app.container.interfaces import IObjectMovedEvent
- >>> from Products.Five.event import IObjectWillBeMovedEvent
- >>> from Products.Five.event import IFiveObjectClonedEvent
+ >>> from OFS.interfaces import IObjectWillBeMovedEvent
+ >>> from OFS.interfaces import IObjectClonedEvent
>>> from OFS.interfaces import IItem
>>> from zope.app.tests import ztapi
>>> def printObjectEvent(object, event):
@@ -73,12 +73,12 @@
>>> def printObjectEventExceptSome(object, event):
... if (IObjectMovedEvent.providedBy(event) or
... IObjectWillBeMovedEvent.providedBy(event) or
- ... IFiveObjectClonedEvent.providedBy(event)):
+ ... IObjectClonedEvent.providedBy(event)):
... return
... print event.__class__.__name__, object.getId()
>>> ztapi.handle((IItem, IObjectMovedEvent), printObjectEvent)
>>> ztapi.handle((IItem, IObjectWillBeMovedEvent), printObjectEvent)
- >>> ztapi.handle((IItem, IFiveObjectClonedEvent), printObjectEvent)
+ >>> ztapi.handle((IItem, IObjectClonedEvent), printObjectEvent)
>>> ztapi.handle((None, IObjectEvent), printObjectEventExceptSome)
@@ -266,7 +266,7 @@
ObjectWillBeAddedEvent copy_of_blueberry
ObjectAddedEvent copy_of_blueberry
old manage_afterAdd copy_of_blueberry copy_of_blueberry folder
- FiveObjectClonedEvent copy_of_blueberry
+ ObjectClonedEvent copy_of_blueberry
old manage_afterClone copy_of_blueberry copy_of_blueberry
[{'new_id': 'copy_of_blueberry', 'id': 'blueberry'}]
@@ -285,7 +285,7 @@
ObjectWillBeAddedEvent strawberry
ObjectAddedEvent strawberry
old manage_afterAdd strawberry strawberry folder
- FiveObjectClonedEvent strawberry
+ ObjectClonedEvent strawberry
old manage_afterClone strawberry strawberry
>>> res.getId()
'strawberry'
@@ -343,9 +343,9 @@
old manage_afterAdd mickey mickey folder
ObjectAddedEvent donald
old manage_afterAdd donald mickey folder
- FiveObjectClonedEvent mickey
+ ObjectClonedEvent mickey
old manage_afterClone mickey mickey
- FiveObjectClonedEvent donald
+ ObjectClonedEvent donald
old manage_afterClone donald mickey
>>> res.getId()
'mickey'
@@ -395,7 +395,7 @@
ObjectCopiedEvent copy_of_dilbert
ObjectWillBeAddedEvent copy_of_dilbert
ObjectAddedEvent copy_of_dilbert
- FiveObjectClonedEvent copy_of_dilbert
+ ObjectClonedEvent copy_of_dilbert
[{'new_id': 'copy_of_dilbert', 'id': 'dilbert'}]
Then rename::
@@ -410,7 +410,7 @@
ObjectCopiedEvent phb
ObjectWillBeAddedEvent phb
ObjectAddedEvent phb
- FiveObjectClonedEvent phb
+ ObjectClonedEvent phb
>>> res.getId()
'phb'
@@ -458,8 +458,8 @@
ObjectWillBeAddedEvent mel
ObjectAddedEvent serenity
ObjectAddedEvent mel
- FiveObjectClonedEvent serenity
- FiveObjectClonedEvent mel
+ ObjectClonedEvent serenity
+ ObjectClonedEvent mel
>>> res.getId()
'serenity'
More information about the z3-checkins
mailing list