[Zope3-checkins] CVS: Zope3/src/zope/app/services - cache.py:1.3 configure.zcml:1.6 hub.py:1.4 event.py:NONE
Steve Alexander
steve@cat-box.net
Mon, 30 Dec 2002 09:03:48 -0500
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv23914/src/zope/app/services
Modified Files:
cache.py configure.zcml hub.py
Removed Files:
event.py
Log Message:
Large refactoring of the event service.
=== Zope3/src/zope/app/services/cache.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/services/cache.py:1.2 Wed Dec 25 09:13:19 2002
+++ Zope3/src/zope/app/services/cache.py Mon Dec 30 09:03:16 2002
@@ -23,10 +23,9 @@
from zope.app.interfaces.services.configuration \
import INameComponentConfigurable
from zope.app.services.configuration import NameComponentConfigurable
-from zope.app.services.event \
- import ProtoServiceEventChannel
+from zope.app.services.event import ServiceSubscriberEventChannel
from zope.proxy.context import ContextMethod
-from zope.interfaces.event import IEventChannel
+from zope.app.interfaces.services.event import IEventChannel
from zope.app.interfaces.event import IObjectModifiedEvent
@@ -35,10 +34,10 @@
"""TTW manageable caching service"""
-class CachingService(ProtoServiceEventChannel, NameComponentConfigurable):
+class CachingService(ServiceSubscriberEventChannel, NameComponentConfigurable):
__implements__ = (ILocalCachingService,
- ProtoServiceEventChannel.__implements__)
+ ServiceSubscriberEventChannel.__implements__)
_subscribeToServiceInterface = IObjectModifiedEvent
@@ -48,7 +47,7 @@
# super(ClassName, self).__init__(*args, **kw), then we can
# replace the following with just a call to super.
Persistent.__init__(self)
- ProtoServiceEventChannel.__init__(self)
+ ServiceSubscriberEventChannel.__init__(self)
NameComponentConfigurable.__init__(self)
def getCache(wrapped_self, name):
=== Zope3/src/zope/app/services/configure.zcml 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/configure.zcml:1.5 Mon Dec 30 07:50:27 2002
+++ Zope3/src/zope/app/services/configure.zcml Mon Dec 30 09:03:16 2002
@@ -2,149 +2,154 @@
<!-- Configuration registries -->
- <content class="zope.app.services.configuration.ConfigurationRegistry">
- <require
- permission="zope.ManageServices"
- interface=
- "zope.app.interfaces.services.configuration.IConfigurationRegistry"
- />
- </content>
+<content class="zope.app.services.configuration.ConfigurationRegistry">
+ <require
+ permission="zope.ManageServices"
+ interface=
+ "zope.app.interfaces.services.configuration.IConfigurationRegistry"
+ />
+</content>
<!-- Adapter Service -->
- <content class="zope.app.services.adapter.AdapterService">
- <implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
- />
- <factory
- id="zope.app.services.AdapterService"
- permission="zope.ManageServices"
- />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.services.configuration.IConfigurable"
- attributes="getRegisteredMatching"
- />
- </content>
-
- <content class="zope.app.services.adapter.AdapterConfiguration">
- <require
- permission="zope.ManageServices"
- interface=
- "zope.app.interfaces.services.interfaces.IAdapterConfiguration"
- set_schema=
- "zope.app.interfaces.services.configuration.IConfiguration"
- />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.container.IDeleteNotifiable"
- />
- </content>
+<content class="zope.app.services.adapter.AdapterService">
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
+ />
+ <factory
+ id="zope.app.services.AdapterService"
+ permission="zope.ManageServices"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.configuration.IConfigurable"
+ attributes="getRegisteredMatching"
+ />
+</content>
+
+<content class="zope.app.services.adapter.AdapterConfiguration">
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.interfaces.IAdapterConfiguration"
+ set_schema="zope.app.interfaces.services.configuration.IConfiguration"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.container.IDeleteNotifiable"
+ />
+</content>
<!-- View Service -->
- <content class="zope.app.services.view.ViewService">
- <implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
- <factory
- id="zope.app.services.ViewService"
- permission="zope.ManageServices"
- />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.services.configuration.IConfigurable"
- attributes="getRegisteredMatching"
- />
- </content>
-
- <content class="zope.app.services.view.ViewConfiguration">
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.services.interfaces.IViewConfiguration"
- set_schema=
- "zope.app.interfaces.services.configuration.IConfiguration"
- />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.container.IDeleteNotifiable"
- />
- </content>
-
- <content class="zope.app.services.view.PageConfiguration">
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.services.interfaces.IPageConfiguration"
- set_schema=
- "zope.app.interfaces.services.configuration.IConfiguration"
- />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.container.IDeleteNotifiable"
- />
- </content>
+<content class="zope.app.services.view.ViewService">
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
+ <factory
+ id="zope.app.services.ViewService"
+ permission="zope.ManageServices"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.configuration.IConfigurable"
+ attributes="getRegisteredMatching"
+ />
+</content>
+
+<content class="zope.app.services.view.ViewConfiguration">
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.interfaces.IViewConfiguration"
+ set_schema="zope.app.interfaces.services.configuration.IConfiguration"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.container.IDeleteNotifiable"
+ />
+</content>
+
+<content class="zope.app.services.view.PageConfiguration">
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.interfaces.IPageConfiguration"
+ set_schema="zope.app.interfaces.services.configuration.IConfiguration"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.container.IDeleteNotifiable"
+ />
+</content>
<!-- Page Templates -->
- <content class="zope.app.services.zpt.ZPTTemplate">
- <factory
- id="zope.app.services.zpt.template"
- permission="zope.ManageServices"
- title="ZPT Template"
- description="Page Template" />
-
- <require
- permission="zope.View"
- attributes="__call__" />
-
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.services.interfaces.IZPTTemplate"
- set_schema="zope.app.interfaces.services.interfaces.IZPTTemplate" />
-
- <implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
- </content>
+<content class="zope.app.services.zpt.ZPTTemplate">
+ <factory
+ id="zope.app.services.zpt.template"
+ permission="zope.ManageServices"
+ title="ZPT Template"
+ description="Page Template"
+ />
+ <require
+ permission="zope.View"
+ attributes="__call__"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.services.interfaces.IZPTTemplate"
+ set_schema="zope.app.interfaces.services.interfaces.IZPTTemplate"
+ />
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
+ />
+</content>
<!-- Role Templates -->
- <content class="zope.app.services.role.RoleService">
- <factory
- id="RoleService"
- permission="zope.ManageServices"
- />
- <require
- permission="zope.Security"
- interface="zope.app.interfaces.security.IRoleService" />
- <require
- permission="zope.ManageServices"
- interface="zope.app.interfaces.container.IContainer" />
- <implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
- </content>
-
- <content class="zope.app.services.role.Role">
- <factory />
- <require
- permission="zope.Security"
- interface="zope.app.interfaces.security.IRole" />
- </content>
+<content class="zope.app.services.role.RoleService">
+ <factory
+ id="RoleService"
+ permission="zope.ManageServices"
+ />
+ <require
+ permission="zope.Security"
+ interface="zope.app.interfaces.security.IRoleService"
+ />
+ <require
+ permission="zope.ManageServices"
+ interface="zope.app.interfaces.container.IContainer"
+ />
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
+ />
+</content>
+
+<content class="zope.app.services.role.Role">
+ <factory />
+ <require
+ permission="zope.Security"
+ interface="zope.app.interfaces.security.IRole"
+ />
+</content>
<!-- Session Templates -->
- <serviceType
- id="Sessions"
- interface="zope.app.interfaces.services.session.ISessionService" />
+<serviceType
+ id="Sessions"
+ interface="zope.app.interfaces.services.session.ISessionService"
+ />
- <content class="zope.app.services.session.CookieSessionService">
- <require
+<content class="zope.app.services.session.CookieSessionService">
+ <require
permission="zope.Public"
- interface="zope.app.interfaces.services.session.ISessionService" />
- <factory
+ interface="zope.app.interfaces.services.session.ISessionService"
+ />
+ <factory
id="ISessionService"
- permission="zope.ManageServices" />
+ permission="zope.ManageServices"
+ />
<implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
- </content>
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
+ />
+</content>
<!-- Caching Service -->
@@ -361,26 +366,6 @@
/>
</content>
-<!-- Event Service -->
-
- <content class='zope.app.services.event.LocalEventService'>
-
- <factory
- id='Events'
- permission='zope.ManageServices' />
-
- <require
- permission="zope.View"
- attributes="publish notify" />
- <require
- permission="zope.ManageServices"
- attributes="bound unbound subscribe unsubscribe subscribeOnBind
- unsubscribedFrom subscribedTo" />
- <implements
- interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
- />
- </content>
-
<!-- Error reporting service -->
<serviceType
@@ -403,7 +388,7 @@
<!-- Object Hub -->
<serviceType
- id='ObjectHub'
+ id='HubIds'
interface='zope.app.interfaces.services.hub.IObjectHub' />
<content class='zope.app.services.hub.ObjectHub'>
@@ -457,5 +442,30 @@
<implements
interface="zope.app.interfaces.annotation.IAttributeAnnotatable" />
</content>
+
+<!-- Event Service -->
+<content class='zope.app.services.event.EventService'>
+ <factory
+ id='Events'
+ permission='zope.ManageServices'
+ />
+ <require
+ permission="zope.View"
+ attributes="publish notify"
+ />
+ <require
+ permission="zope.ManageServices"
+ attributes="bound unbound subscribe unsubscribe subscribeOnBind
+ unsubscribedFrom subscribedTo"
+ />
+ <implements
+ interface="zope.app.interfaces.annotation.IAttributeAnnotatable."
+ />
+</content>
+
+<serviceType
+ id='Subscription'
+ interface='zope.app.interfaces.services.event.ISubscriptionService'
+ />
</zopeConfigure>
=== Zope3/src/zope/app/services/hub.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/hub.py:1.3 Sat Dec 28 09:13:28 2002
+++ Zope3/src/zope/app/services/hub.py Mon Dec 30 09:03:16 2002
@@ -39,7 +39,7 @@
from zope.app.interfaces.event import IObjectMovedEvent, IObjectCreatedEvent
from zope.app.interfaces.event import IObjectModifiedEvent
from zope.app.interfaces.services.hub import IObjectHub, ObjectHubError
-from zope.app.services.event import ProtoServiceEventChannel
+from zope.app.services.event import ServiceSubscriberEventChannel
from zope.app.interfaces.services.hub import IObjectRegisteredHubEvent
from zope.app.interfaces.services.hub import IObjectUnregisteredHubEvent
from zope.app.interfaces.services.hub import IObjectModifiedHubEvent
@@ -162,7 +162,7 @@
else:
return abs
-class ObjectHub(ProtoServiceEventChannel):
+class ObjectHub(ServiceSubscriberEventChannel, ):
# this implementation makes the decision to not interact with any
# object hubs above it: it is a world unto itself, as far as it is
@@ -171,10 +171,10 @@
__implements__ = (
IObjectHub,
- ProtoServiceEventChannel.__implements__)
+ ServiceSubscriberEventChannel.__implements__)
def __init__(self):
- ProtoServiceEventChannel.__init__(self)
+ ServiceSubscriberEventChannel.__init__(self)
# int --> tuple of unicodes
self.__hubid_to_location = IOBTree()
# tuple of unicodes --> int
@@ -183,16 +183,13 @@
# XXX this is copied because of some context method problems
# with moving LocalEventChannel.notify to this _notify via a simple
# assignment, i.e. _notify = LocalEventChannel.notify
- def _notify(clean_self, wrapped_self, event):
- subscriptionses = clean_self.subscriptionsForEvent(event)
- # that's a non-interface shortcut for
- # subscriptionses = clean_self._registry.getAllForObject(event)
-
- for subscriptions in subscriptionses:
- for subscriber, filter in subscriptions:
- if filter is not None and not filter(event):
- continue
- ContextWrapper(subscriber, wrapped_self).notify(event)
+ #def _notify(clean_self, wrapped_self, event):
+ # subscriptionsForEvent = clean_self._registry.getAllForObject(event)
+ # for subscriptions in subscriptionsForEvent:
+ # for subscriber, filter in subscriptions:
+ # if filter is not None and not filter(event):
+ # continue
+ # ContextWrapper(subscriber, wrapped_self).notify(event)
def notify(wrapped_self, event):
'''See interface ISubscriber'''
=== Removed File Zope3/src/zope/app/services/event.py ===