[Zope3-checkins] SVN: Zope3/branches/jim-simplifyevents/src/zope/app/event/ Removed support for event:subscribe directive, since we can just use

Jim Fulton jim at zope.com
Wed May 26 07:18:20 EDT 2004


Log message for revision 24993:
Removed support for event:subscribe directive, since we can just use 
subscription adapters.



-=-
Deleted: Zope3/branches/jim-simplifyevents/src/zope/app/event/meta.zcml
===================================================================
--- Zope3/branches/jim-simplifyevents/src/zope/app/event/meta.zcml	2004-05-26 11:16:39 UTC (rev 24992)
+++ Zope3/branches/jim-simplifyevents/src/zope/app/event/meta.zcml	2004-05-26 11:18:20 UTC (rev 24993)
@@ -1,16 +0,0 @@
-<configure
-    xmlns='http://namespaces.zope.org/zope'
-    xmlns:meta="http://namespaces.zope.org/meta"
-    >
-
-  <meta:directives namespace="http://namespaces.zope.org/event">
-
-    <meta:directive
-        name="subscribe"
-        schema=".metadirectives.ISubscribeDirective"
-        handler=".metaconfigure.subscribe"
-        />
-
-  </meta:directives>
-
-</configure>

Deleted: Zope3/branches/jim-simplifyevents/src/zope/app/event/metaconfigure.py
===================================================================
--- Zope3/branches/jim-simplifyevents/src/zope/app/event/metaconfigure.py	2004-05-26 11:16:39 UTC (rev 24992)
+++ Zope3/branches/jim-simplifyevents/src/zope/app/event/metaconfigure.py	2004-05-26 11:18:20 UTC (rev 24993)
@@ -1,31 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-# 
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (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.
-# 
-##############################################################################
-"""
-$Id$
-"""
-
-from zope.app.event.interfaces import IEvent
-from globalservice import globalSubscribeMany
-
-directive_counter = 0
-def subscribe(_context, subscriber, event_types=[IEvent], filter=None):
-    global directive_counter
-    directive_counter += 1
-
-    _context.action(
-        # subscriptions can never conflict
-        discriminator = ('subscribe', directive_counter),
-        callable = globalSubscribeMany,
-        args = (subscriber, event_types, filter)
-        )

Deleted: Zope3/branches/jim-simplifyevents/src/zope/app/event/metadirectives.py
===================================================================
--- Zope3/branches/jim-simplifyevents/src/zope/app/event/metadirectives.py	2004-05-26 11:16:39 UTC (rev 24992)
+++ Zope3/branches/jim-simplifyevents/src/zope/app/event/metadirectives.py	2004-05-26 11:18:20 UTC (rev 24993)
@@ -1,41 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-# 
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (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.
-# 
-##############################################################################
-"""
-$Id$
-"""
-
-from zope.interface import Interface
-from zope.configuration.fields import GlobalObject, Tokens
-
-class ISubscribeDirective(Interface):
-    """
-    Subscribe to events
-    """
-
-    subscriber = GlobalObject(
-        title=u"Subscriber",
-        required=True
-        )
-
-    event_types = Tokens(
-        title=u"Events to subscribe to",
-        description=u"Defaults to IEvent",
-        required=False,
-        value_type = GlobalObject()
-        )
-
-    filter = GlobalObject(
-        title=u"Filter",
-        required=False
-        )

Deleted: Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/test_directives.py	2004-05-26 11:16:39 UTC (rev 24992)
+++ Zope3/branches/jim-simplifyevents/src/zope/app/event/tests/test_directives.py	2004-05-26 11:18:20 UTC (rev 24993)
@@ -1,80 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (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.
-#
-##############################################################################
-"""
-$Id$
-"""
-from unittest import TestCase, main, makeSuite
-
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-import zope.app.event
-from StringIO import StringIO
-
-from zope.exceptions import NotFoundError
-from zope.app.event import globalUnsubscribe, publish
-from zope.app.container.contained import ObjectAddedEvent
-from zope.app.container.contained import ObjectRemovedEvent
-from zope.app.event.objectevent import ObjectModifiedEvent
-from zope.app.event.tests.test_eventpublisher import DummyEvent
-from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component import getGlobalServices
-from zope.app.servicenames import EventPublication
-from zope.app.event.interfaces import IEvent
-
-class Test(PlacelessSetup, TestCase):
-
-    def setUp(self):
-        super(Test, self).setUp()
-        from zope.app.event.interfaces import IPublisher
-        getGlobalServices().defineService(EventPublication, IPublisher)
-        from zope.app.event.globalservice import eventPublisher
-        getGlobalServices().provideService(EventPublication, eventPublisher)
-
-    def testSubscribe(self):
-        from zope.app.event.tests.subscriber import subscriber
-        # This should do nothing silently, as the event_type is default
-        globalUnsubscribe(subscriber)
-        # This should fail, since we're not subscribed
-        self.assertRaises(NotFoundError, globalUnsubscribe, subscriber, IEvent)
-        XMLConfig('meta.zcml', zope.app.event)()
-        xmlconfig(StringIO(
-            '''<configure xmlns='http://namespaces.zope.org/zope'
-                              xmlns:test='http://namespaces.zope.org/event'>
-            <test:subscribe
-                   subscriber="zope.app.event.tests.subscriber.subscriber"
-                   event_types=
-                       "zope.app.container.interfaces.IObjectAddedEvent
-                        zope.app.container.interfaces.IObjectRemovedEvent"
-                   filter="zope.app.event.tests.subscriber.filter" />
-            </configure>'''
-            ))
-
-        parent= object()
-        publish(None, ObjectAddedEvent(None, parent, 'foo'))
-        self.assertEqual(subscriber.notified, 1)
-        publish(None, ObjectRemovedEvent(object(), parent, 'foo'))
-        self.assertEqual(subscriber.notified, 2)
-        publish(None, ObjectModifiedEvent(None))
-        self.assertEqual(subscriber.notified, 2) # NB: no increase ;-)
-        publish(None, DummyEvent())
-        self.assertEqual(subscriber.notified, 4) # NB: increased by 2 ;-)
-
-        globalUnsubscribe(subscriber)
-
-        subscriber.notified = 0
-
-def test_suite():
-    return makeSuite(Test)
-
-if __name__ == '__main__':
-    main(defaultTest='test_suite')




More information about the Zope3-Checkins mailing list