[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/LocalEventService - LocalServiceSubscribable.py:1.8
Albertas Agejevas
alga@codeworks.lt
Fri, 6 Dec 2002 13:03:32 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/LocalEventService
In directory cvs.zope.org:/tmp/cvs-serv32707/lib/python/Zope/App/OFS/Services/LocalEventService
Modified Files:
LocalServiceSubscribable.py
Log Message:
Make CachingService an EventChannel.
On the way made LocalServiceSubscribable work when there is no next service.
=== Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalServiceSubscribable.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalServiceSubscribable.py:1.7 Mon Nov 11 03:38:36 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/LocalEventService/LocalServiceSubscribable.py Fri Dec 6 13:03:31 2002
@@ -23,7 +23,7 @@
from Zope.Proxy.ProxyIntrospection import removeAllProxies
from Zope.Proxy.ContextWrapper import ContextWrapper
from LocalSubscribable import LocalSubscribable
-from Zope.App.ComponentArchitecture.NextService import getNextService
+from Zope.App.ComponentArchitecture.NextService import getNextService, queryNextService
class LocalServiceSubscribable(LocalSubscribable):
"""a local mix-in for services"""
@@ -53,9 +53,9 @@
break
else:
# raise NotFoundError(subscriber)
- getNextService(
- wrapped_self, clean_self._serviceName).unsubscribe(
- subscriber, event_type, filter)
+ next_service = queryNextService(wrapped_self, clean_self._serviceName)
+ if next_service is not None:
+ next_service.unsubscribe(subscriber, event_type, filter)
return
@@ -70,9 +70,9 @@
# converted to 'None' so that the _registry can
# shortcut some of its tests
if ev_type not in ev_set:
- getNextService(
- wrapped_self, clean_self._serviceName).unsubscribe(
- subscriber, event_type, filter)
+ next_service = queryNextService(wrapped_self, clean_self._serviceName)
+ if next_service is not None:
+ next_service.unsubscribe(subscriber, event_type, filter)
else:
subscriptions = clean_self._registry.get(ev_type)
try:
@@ -105,9 +105,9 @@
else: # kept (added back)
subscriptions.append(sub)
del clean_self._subscribers[subscriber_index]
- getNextService(
- wrapped_self, clean_self._serviceName).unsubscribe(
- subscriber, event_type, filter)
+ next_service = queryNextService(wrapped_self, clean_self._serviceName)
+ if next_service is not None:
+ next_service.unsubscribe(subscriber, event_type, filter)
clean_self._p_changed = 1 #trigger persistence
unsubscribe = ContextMethod(unsubscribe)
@@ -118,8 +118,9 @@
clean_self = removeAllProxies(wrapped_self)
result = LocalSubscribable.listSubscriptions(
clean_self, subscriber, event_type)
- result.extend(getNextService(
- wrapped_self, clean_self._serviceName).listSubscriptions(
- subscriber, event_type))
+ next_service = queryNextService(wrapped_self, clean_self._serviceName)
+ if next_service is not None:
+ result.extend(next_service.listSubscriptions(subscriber,
+ event_type))
return result
listSubscriptions = ContextMethod(listSubscriptions)