[z3-checkins] r19720 - in z3/Five/trunk: . doc doc/products/FiveMiscTutorial doc/products/InterfaceTutorial tests

efge at codespeak.net efge at codespeak.net
Thu Nov 10 16:26:53 CET 2005


Author: efge
Date: Thu Nov 10 16:26:53 2005
New Revision: 19720

Added:
   z3/Five/trunk/doc/event.txt
      - copied unchanged from r19712, z3/Five/branch/Five-1.3/doc/event.txt
Modified:
   z3/Five/trunk/CHANGES.txt
   z3/Five/trunk/doc/products/FiveMiscTutorial/__init__.py
   z3/Five/trunk/doc/products/InterfaceTutorial/__init__.py
   z3/Five/trunk/doc/products/InterfaceTutorial/module.py
   z3/Five/trunk/doc/products/InterfaceTutorial/other.py
   z3/Five/trunk/tests/event.txt
   z3/Five/trunk/tests/test_event.py
Log:
Merged 19705:19712 from Five-1.3 branch.
Trunk is now in sync with 19712 on the 1.3 branch.

* Fixed some event recursion compatibility modes.



Modified: z3/Five/trunk/CHANGES.txt
==============================================================================
--- z3/Five/trunk/CHANGES.txt	(original)
+++ z3/Five/trunk/CHANGES.txt	Thu Nov 10 16:26:53 2005
@@ -2,6 +2,11 @@
 Five Changes
 ============
 
+Five 1.3b2 (2005-11-10)
+=======================
+
+This version is included in Zope 2 trunk as of this date.
+
 Five 1.3b (2005-11-02)
 ======================
 
@@ -45,6 +50,8 @@
 * Fixed bug that broke WebDAV access for five:defaultViewable objects. The
   __browser_default__ now modifies only GET and POST requests.
 
+* Fixed some event recursion compatibility modes.
+
 Five 1.2b (2005-11-02)
 ======================
 

Modified: z3/Five/trunk/doc/products/FiveMiscTutorial/__init__.py
==============================================================================
--- z3/Five/trunk/doc/products/FiveMiscTutorial/__init__.py	(original)
+++ z3/Five/trunk/doc/products/FiveMiscTutorial/__init__.py	Thu Nov 10 16:26:53 2005
@@ -1 +1,14 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
 # this is a package.

Modified: z3/Five/trunk/doc/products/InterfaceTutorial/__init__.py
==============================================================================
--- z3/Five/trunk/doc/products/InterfaceTutorial/__init__.py	(original)
+++ z3/Five/trunk/doc/products/InterfaceTutorial/__init__.py	Thu Nov 10 16:26:53 2005
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
 import module, other
 
 def initialize(context):

Modified: z3/Five/trunk/doc/products/InterfaceTutorial/module.py
==============================================================================
--- z3/Five/trunk/doc/products/InterfaceTutorial/module.py	(original)
+++ z3/Five/trunk/doc/products/InterfaceTutorial/module.py	Thu Nov 10 16:26:53 2005
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
 from zope.interface import Interface, implements
 
 class IElephant(Interface):

Modified: z3/Five/trunk/doc/products/InterfaceTutorial/other.py
==============================================================================
--- z3/Five/trunk/doc/products/InterfaceTutorial/other.py	(original)
+++ z3/Five/trunk/doc/products/InterfaceTutorial/other.py	Thu Nov 10 16:26:53 2005
@@ -1,3 +1,16 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
 from zope.interface import Interface, implements
 from module import INoiseMaker, IElephant, AfricanElephant
 

Modified: z3/Five/trunk/tests/event.txt
==============================================================================
--- z3/Five/trunk/tests/event.txt	(original)
+++ z3/Five/trunk/tests/event.txt	Thu Nov 10 16:26:53 2005
@@ -86,38 +86,69 @@
   >>> zcml.load_config('meta.zcml', zope.app.component)
   >>> zcml.load_config('event.zcml', Products.Five)
 
+We need at least one fake deprecated method to tell the compatibility
+framework that component architecture is initialized::
+
+  >>> from Products.Five.eventconfigure import setDeprecatedManageAddDelete
+  >>> class C(object): pass
+  >>> setDeprecatedManageAddDelete(C)
+
 Old class
 =========
 
 If we use an instance of an old class for which we haven't specified
 anything, events are sent and the manage_afterAdd & co methods are
-called but in a "compatibility" way.
-
-Because the bases classes of Zope have been changed to not recurse
-except through the event framework, unexpected behavior may happen
-(however a warning will be sent)::
+called, but with a deprecation warning::
 
+  >>> sub = MyFolder('sub')
+  >>> folder._setObject('sub', sub)
+  ObjectWillBeAddedEvent sub
+  ObjectAddedEvent sub
+  old manage_afterAdd sub sub folder
+  'sub'
+  >>> sub = folder.sub
   >>> ob = MyContent('dog')
-  >>> folder._setObject('dog', ob)
+  >>> sub._setObject('dog', ob)
   ObjectWillBeAddedEvent dog
   ObjectAddedEvent dog
-  old manage_afterAdd dog dog folder
+  old manage_afterAdd dog dog sub
   'dog'
 
-And when we delete the object, manage_beforeDelete is also called and
-events are sent::
+And when we rename the subfolder, manage_beforeDelete is also called
+bottom-up and events are sent::
 
-  >>> folder.manage_delObjects('dog')
-  old manage_beforeDelete dog dog folder
-  ObjectWillBeRemovedEvent dog
-  ObjectRemovedEvent dog
+  >>> folder.manage_renameObject('sub', 'marine')
+  ObjectWillBeMovedEvent sub
+  ObjectWillBeMovedEvent dog
+  old manage_beforeDelete dog sub folder
+  old manage_beforeDelete sub sub folder
+  ObjectMovedEvent marine
+  old manage_afterAdd marine marine folder
+  ObjectMovedEvent dog
+  old manage_afterAdd dog marine folder
+
+Same thing for clone::
+
+  >>> res = folder.manage_clone(folder.marine, 'tank')
+  ObjectCopiedEvent tank
+  ObjectWillBeAddedEvent tank
+  ObjectWillBeAddedEvent dog
+  ObjectAddedEvent tank
+  old manage_afterAdd tank tank folder
+  ObjectAddedEvent dog
+  old manage_afterAdd dog tank folder
+  ObjectClonedEvent tank
+  old manage_afterClone tank tank
+  ObjectClonedEvent dog
+  old manage_afterClone dog tank
+  >>> res.getId()
+  'tank'
 
 Old class with deprecatedManageAddDelete
 ========================================
 
 We specifiy that our class is deprecated (using zcml in real life)::
 
-  >>> from Products.Five.eventconfigure import setDeprecatedManageAddDelete
   >>> setDeprecatedManageAddDelete(MyContent)
   >>> setDeprecatedManageAddDelete(MyFolder)
   >>> setDeprecatedManageAddDelete(MyOrderedFolder)

Modified: z3/Five/trunk/tests/test_event.py
==============================================================================
--- z3/Five/trunk/tests/test_event.py	(original)
+++ z3/Five/trunk/tests/test_event.py	Thu Nov 10 16:26:53 2005
@@ -40,11 +40,17 @@
     def manage_afterAdd(self, item, container):
         print 'old manage_afterAdd %s %s %s' % (self.getId(), item.getId(),
                                                 container.getId())
+        super(NotifyBase, self).manage_afterAdd(item, container)
+    manage_afterAdd.__five_method__ = True # Shut up deprecation warnings
     def manage_beforeDelete(self, item, container):
+        super(NotifyBase, self).manage_beforeDelete(item, container)
         print 'old manage_beforeDelete %s %s %s' % (self.getId(), item.getId(),
                                                     container.getId())
+    manage_beforeDelete.__five_method__ = True # Shut up deprecation warnings
     def manage_afterClone(self, item):
         print 'old manage_afterClone %s %s' % (self.getId(), item.getId())
+        super(NotifyBase, self).manage_afterClone(item)
+    manage_afterClone.__five_method__ = True # Shut up deprecation warnings
 
 class MyApp(Folder):
     def getPhysicalRoot(self):


More information about the z3-checkins mailing list