vendor/Five/1.2b-r20590

view eventconfigure.py @ 0:3673ed425f80

Vendor import of Five 1.2b+ (r20590)
author fguillaume
date Fri, 02 Dec 2005 20:25:42 +0000
parents
children
line source
1 ##############################################################################
2 #
3 # Copyright (c) 2004, 2005 Zope Corporation and Contributors.
4 # All Rights Reserved.
5 #
6 # This software is subject to the provisions of the Zope Public License,
7 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11 # FOR A PARTICULAR PURPOSE.
12 #
13 ##############################################################################
14 """
15 Use 'structured monkey patching' to enable zope.app.container event sending for
16 Zope 2 objects.
18 $Id: eventconfigure.py 19416 2005-11-02 15:18:34Z efge $
19 """
21 from Products.Five.event import doMonkies
22 from OFS.subscribers import deprecatedManageAddDeleteClasses
24 def setDeprecatedManageAddDelete(class_):
25 """Instances of the class will still see their old methods called."""
26 deprecatedManageAddDeleteClasses.append(class_)
28 def cleanUp():
29 deprecatedManageAddDeleteClasses[:] = []
31 def containerEvents(_context):
32 _context.action(
33 discriminator=None,
34 callable=doMonkies,
35 args=(),
36 )
38 def deprecatedManageAddDelete(_context, class_):
39 _context.action(
40 discriminator=('five:deprecatedManageAddDelete', class_),
41 callable=setDeprecatedManageAddDelete,
42 args=(class_,),
43 )
45 from zope.testing.cleanup import addCleanUp
46 addCleanUp(cleanUp)
47 del addCleanUp