[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/LocalEventService - LocalEventService.py:1.1.2.6 LocalServiceSubscribable.py:1.1.2.3 LocalSubscribable.py:1.1.2.3 PathSubscriber.py:1.1.2.2 localEventService.zcml:1.1.2.3
Gary Poster
garyposter@earthlink.net
Tue, 21 May 2002 09:44:40 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/LocalEventService
In directory cvs.zope.org:/tmp/cvs-serv25923/lib/python/Zope/App/OFS/Services/LocalEventService
Modified Files:
Tag: Zope-3x-branch
LocalEventService.py LocalServiceSubscribable.py
LocalSubscribable.py PathSubscriber.py localEventService.zcml
Log Message:
A few more bug fixes and tweaks to various event service and service manager files; a very rudimentary view for the event service (it doesn't show much information because not much information is available from the interfaces!). The event service prototype should be ready for folks to play with a bit now.
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalEventService.py 1.1.2.5 => 1.1.2.6 ===
from Zope.Event.IEvent import IEvent
-class ILocalEventService(IEventService, ISubscriber, IBindingAware, ISubscriptionAware):
+class ILocalEventService(
+ IEventService, ISubscriber, IBindingAware, ISubscriptionAware):
def isPromotableEvent(event):
"""a hook. Returns a true value if, when publishing an
@@ -123,7 +124,8 @@
subscriber=PathSubscriber(wrapped_self)
clean_self._v_unbinding=1
for subscription in clean_self._subscriptions:
- subscribable=getAdapter(wrapped_self, ITraverser).traverse(subscription[0])
+ subscribable=getAdapter(
+ wrapped_self, ITraverser).traverse(subscription[0])
subscribable.unsubscribe(subscriber)
clean_self._subscriptions=()
for subscriber in clean_self._subscribers:
@@ -159,7 +161,7 @@
else: # kept (added back)
subscriptions.append(sub)
del clean_self._subscribers[subscriber_index]
- clean_self._registry=clean_self._registry #trigger persistence, if pertinent
+ clean_self._registry=clean_self._registry #trigger persistence
def unsubscribedFrom(wrapped_self, subscribable, event_type, filter):
"see ISubscriptionAware"
@@ -170,17 +172,20 @@
# itself: we need to remove the higher level event service
# from our subscriptions list and try to find another event
# service to which to attach
- LocalSubscriptionAware.unsubscribedFrom(clean_self, subscribable, event_type, filter)
+ LocalSubscriptionAware.unsubscribedFrom(
+ clean_self, subscribable, event_type, filter)
clean_subscribable=removeAllProxies(subscribable)
if IEventService.isImplementedBy(removeAllProxies(clean_subscribable)):
context=getService(wrapped_self, "Events")
# we do this instead of getNextService because the order
# of unbinding and notification of unbinding is not
# guaranteed
- while removeAllProxies(context) in (clean_subscribable, clean_self):
+ while removeAllProxies(context) in (
+ clean_subscribable, clean_self):
context=getNextService(context, "Events")
# XXX as usual, we *must not* be working with a global service;
- # this probably should raise an error if service is global service...
+ # this probably should raise an error if service is global
+ # service...
# that leaves replacing top level event services an
# interesting question, however
context.subscribe(PathSubscriber(wrapped_self))
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalServiceSubscribable.py 1.1.2.2 => 1.1.2.3 ===
ev_type=None # handle optimization
if ev_type not in ev_set:
- getNextService(wrapped_self, clean_self._serviceName).unsubscribe(
+ getNextService(
+ wrapped_self, clean_self._serviceName).unsubscribe(
subscriber, event_type, filter)
else:
subscriptions = clean_self._registry.getJustForType(ev_type)
@@ -67,7 +68,8 @@
except ValueError:
raise NotFoundError(subscriber, event_type, filter)
if do_alert:
- wrapped_subscriber.unsubscribedFrom(self, event_type, filter)
+ wrapped_subscriber.unsubscribedFrom(
+ self, event_type, filter)
if len(ev_set)==1:
for sub in subscriptions:
if sub[0]==subscriber:
@@ -90,7 +92,7 @@
del clean_self._subscribers[subscriber_index]
getNextService(wrapped_self, clean_self._serviceName).unsubscribe(
subscriber, event_type, filter)
- clean_self._registry=clean_self._registry #trigger persistence, if pertinent
+ clean_self._registry=clean_self._registry #trigger persistence
unsubscribe=ContextMethod(unsubscribe)
@@ -98,7 +100,8 @@
subscriber=removeAllProxies(subscriber) # might be wrapped, might not
clean_self=removeAllProxies(wrapped_self)
- result=LocalSubscribable.listSubscriptions(clean_self, subscriber, event_type)
+ result=LocalSubscribable.listSubscriptions(
+ clean_self, subscriber, event_type)
result.extend(getNextService(
wrapped_self, clean_self._serviceName).listSubscriptions(
subscriber, event_type))
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalSubscribable.py 1.1.2.2 => 1.1.2.3 ===
subs.append((subscriber,{ev_type:1}))
- clean_self._registry=clean_self._registry #trigger persistence, if pertinent
+ clean_self._registry=clean_self._registry #trigger persistence
subscribe=ContextMethod(subscribe)
@@ -113,6 +113,6 @@
else: # kept (added back)
subscriptions.append(sub)
del clean_self._subscribers[subscriber_index]
- clean_self._registry=clean_self._registry #trigger persistence, if pertinent
+ clean_self._registry=clean_self._registry #trigger persistence
unsubscribe=ContextMethod(unsubscribe)
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/PathSubscriber.py 1.1.2.1 => 1.1.2.2 ===
def __getSubscriber(self, wrapped_self):
- return getAdapter(wrapped_self, ITraverser).traverse(self.subscriber_path)
+ return getAdapter(wrapped_self, ITraverser).traverse(
+ self.subscriber_path)
def notify(wrapped_self, event):
- removeAllProxies(wrapped_self).__getSubscriber(wrapped_self).notify(event)
+ removeAllProxies(wrapped_self).__getSubscriber(
+ wrapped_self).notify(event)
notify=ContextMethod(notify)
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/localEventService.zcml 1.1.2.2 => 1.1.2.3 ===
description='An event service: use sparingly' />
+ <security:protectClass name=".LocalEventService+"
+ permission_id="Zope.View">
+ <security:protect
+ names="bound, unbound, subscribe, unsubscribe, subscribeOnBind,
+ unsubscribedFrom, subscribedTo"
+ permission_id="Zope.ManageServices" />
+ <security:protect
+ names="publishEvent, notify"
+ permission_id="Zope.View" />
+ </security:protectClass>
+
+<include package=".Views"
+ file="views.zcml" />
+
</zopeConfigure>