[z3-checkins] r19356 - in z3/Five/branch/Five-1.2: . tests
efge at codespeak.net
efge at codespeak.net
Tue Nov 1 17:03:04 CET 2005
Author: efge
Date: Tue Nov 1 17:03:03 2005
New Revision: 19356
Added:
z3/Five/branch/Five-1.2/subscribers.py (contents, props changed)
Modified:
z3/Five/branch/Five-1.2/CHANGES.txt
z3/Five/branch/Five-1.2/configure.zcml
z3/Five/branch/Five-1.2/event.py
z3/Five/branch/Five-1.2/event.zcml
z3/Five/branch/Five-1.2/monkey.py
z3/Five/branch/Five-1.2/tests/event.txt
Log:
Small cleanups, and Five 1.3 forward-compatibility for subscribers
import location.
Modified: z3/Five/branch/Five-1.2/CHANGES.txt
==============================================================================
--- z3/Five/branch/Five-1.2/CHANGES.txt (original)
+++ z3/Five/branch/Five-1.2/CHANGES.txt Tue Nov 1 17:03:03 2005
@@ -2,8 +2,8 @@
Five Changes
============
-Five 1.2b (2005-XXX-XXX)
-========================
+Five 1.2b (2005-11-01)
+======================
Features
--------
@@ -24,6 +24,14 @@
to convert it's portal tools into local utilities. See
doc/localsite.txt for more information
+* Event support: When ``<five:containerEvents/>`` is specified, Five
+ makes the standard Zope 2 containers send events instead of using
+ manage_afterAdd, manage_beforeDelete and manage_afterClone. These
+ methods are still called for a class declared
+ ``<five:deprecatedManageAddDelete class=.../>``, and are called in
+ compatibility mode with a deprecation warning for classes that don't
+ use this directive.
+
Restructuring
-------------
Modified: z3/Five/branch/Five-1.2/configure.zcml
==============================================================================
--- z3/Five/branch/Five-1.2/configure.zcml (original)
+++ z3/Five/branch/Five-1.2/configure.zcml Tue Nov 1 17:03:03 2005
@@ -6,9 +6,6 @@
<include file="interfaces.zcml" />
<include file="permissions.zcml" />
<include file="i18n.zcml" />
- <!-- XXX in Five 1.3, include this -->
- <!-- <include file="event.zcml"/> -->
- <!-- XXX in Five 1.3, fix these deprecations in core Zope instead -->
<include file="deprecated.zcml"/>
<include package=".site" />
<include package=".browser" />
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 Tue Nov 1 17:03:03 2005
@@ -162,21 +162,16 @@
# Adapters and subscribers
from OFS.interfaces import IObjectManager
-from zope.app.location.interfaces import ISublocations
class ObjectManagerSublocations(object):
"""Get the sublocations for an ObjectManager.
"""
- #__used_for__ = IObjectManager
- #implements(ISublocations)
-
def __init__(self, container):
self.container = container
def sublocations(self):
for ob in self.container.objectValues():
yield ob
- # XXX also want to provide opaqueItems's values
# The following subscribers should really be defined in ZCML
# but we don't have enough control over subscriber ordering for
@@ -659,9 +654,6 @@
# They all expects their manage_afterAdd to be called, but they are
# created before Five 1.2 is initialized and has had a chance to do its
# patches. So we call manage_afterAddd by hand.
-#
-# Remove this in Five 1.3, where subscribers and implements()
-# will be setup correctly earlier.
def install_errorlog(self):
app = self.getApp()
@@ -735,7 +727,7 @@
from OFS.Application import AppInitializer
from Products.ZCatalog import CatalogAwareness, CatalogPathAwareness
-def doMonkies(transitional, register_cleanup=True):
+def doMonkies():
"""Monkey patch various methods to provide container events.
"""
global hasContainerEvents
@@ -794,11 +786,9 @@
patchMethod(CatalogPathAwareness.CatalogAware, 'manage_afterClone',
CA_manage_afterClone)
- # XXX remove this for Five 1.3, and put it in configure.zcml
zcml.load_config('event.zcml', Products.Five)
- if register_cleanup:
- addCleanUp(undoMonkies)
+ addCleanUp(undoMonkies)
def patchMethod(class_, name, new_method):
method = getattr(class_, name, None)
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 Tue Nov 1 17:03:03 2005
@@ -1,7 +1,6 @@
<configure xmlns="http://namespaces.zope.org/zope">
<!-- needed to call this during init code -->
- <!-- XXX not needed in Five 1.3, when included by configure.zcml -->
<include package="zope.app.component" file="meta.zcml" />
<!-- Adapter giving sublocations for ObjectManagers, used
@@ -10,7 +9,7 @@
<adapter
for="OFS.interfaces.IObjectManager"
provides="zope.app.location.interfaces.ISublocations"
- factory=".event.ObjectManagerSublocations"
+ factory=".subscribers.ObjectManagerSublocations"
/>
<!-- dispatch IObjectWillBeMovedEvent with "bottom-up" semantics -->
@@ -18,7 +17,7 @@
<subscriber
for="OFS.interfaces.IItem
.event.IObjectWillBeMovedEvent"
- factory=".event.dispatchObjectWillBeMovedEvent"
+ factory=".subscribers.dispatchObjectWillBeMovedEvent"
/>
<!-- dispatch IObjectMovedEvent with "top-down" semantics -->
@@ -26,7 +25,7 @@
<subscriber
for="OFS.interfaces.IItem
zope.app.container.interfaces.IObjectMovedEvent"
- factory=".event.dispatchObjectMovedEvent"
+ factory=".subscribers.dispatchObjectMovedEvent"
/>
<!-- dispatch IFiveObjectClonedEvent with "top-down" semantics -->
@@ -34,7 +33,7 @@
<subscriber
for="OFS.interfaces.IItem
.event.IFiveObjectClonedEvent"
- factory=".event.dispatchFiveObjectClonedEvent"
+ factory=".subscribers.dispatchFiveObjectClonedEvent"
/>
</configure>
Modified: z3/Five/branch/Five-1.2/monkey.py
==============================================================================
--- z3/Five/branch/Five-1.2/monkey.py (original)
+++ z3/Five/branch/Five-1.2/monkey.py Tue Nov 1 17:03:03 2005
@@ -28,13 +28,6 @@
i18n.monkey()
localsites_monkey()
- # XXX in Five 1.3, call this from here:
- if False: # XXX
- from Products.Five import event
- event.doMonkies(transitional=False,
- info='Five/monkey.py',
- register_cleanup=False)
-
def localsites_monkey():
from Acquisition import aq_inner, aq_parent
from zope.component.interfaces import IServiceService
Added: z3/Five/branch/Five-1.2/subscribers.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/Five-1.2/subscribers.py Tue Nov 1 17:03:03 2005
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# 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 Tue Nov 1 17:03:03 2005
@@ -185,7 +185,7 @@
Now execute the directive enabling events::
>>> from Products.Five.event import doMonkies, undoMonkies
- >>> doMonkies(transitional=False)
+ >>> doMonkies()
Old class
---------
More information about the z3-checkins
mailing list