Log message for revision 40374: Forgotten in Five 1.3b4 merge. Changed: A Zope/branches/2.9/lib/python/Products/Five/monkey.py
-=- Added: Zope/branches/2.9/lib/python/Products/Five/monkey.py =================================================================== --- Zope/branches/2.9/lib/python/Products/Five/monkey.py 2005-11-25 21:24:07 UTC (rev 40373) +++ Zope/branches/2.9/lib/python/Products/Five/monkey.py 2005-11-25 21:30:04 UTC (rev 40374) @@ -0,0 +1,71 @@ +############################################################################## +# +# 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. +# +############################################################################## +"""Bad monkey! + +BBB: goes away when Zope 3.2 >= r40368 is stiched in + +$Id$ +""" +def monkeyPatch(): + """Trigger all monkey patches needed to make Five work. + + Monkey patches are kept to a minimum level. + """ + zope3_monkey() + +def zope3_monkey(): + """Fix Zope 3 to have the proper ContainerModifiedEvent that has + been added for 3.2. + """ + try: + from zope.app.container.contained import notifyContainerModified + except ImportError: + pass + else: + return + + # BBB: goes away when Zope 3.2 >= r40368 is stiched in + + from zope.event import notify + from zope.interface import implements + import zope.app.container.contained + import zope.app.container.interfaces + from zope.app.event.objectevent import ObjectModifiedEvent + from zope.app.event.interfaces import IObjectModifiedEvent + + class IContainerModifiedEvent(IObjectModifiedEvent): + """The container has been modified. + + This event is specific to "containerness" modifications, which + means addition, removal or reordering of sub-objects. + """ + + zope.app.container.interfaces.IContainerModifiedEvent = \ + IContainerModifiedEvent + + + class ContainerModifiedEvent(ObjectModifiedEvent): + """The container has been modified.""" + implements(IContainerModifiedEvent) + + zope.app.container.contained.ContainerModifiedEvent = \ + ContainerModifiedEvent + + + def notifyContainerModified(object, *descriptions): + """Notify that the container was modified.""" + notify(ContainerModifiedEvent(object, *descriptions)) + + zope.app.container.contained.notifyContainerModified = \ + notifyContainerModified Property changes on: Zope/branches/2.9/lib/python/Products/Five/monkey.py ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins