[Zope3-checkins] CVS: Zope3/src/zope/app/event - configure.zcml:1.9 objectevent.py:1.13

Nathan Yergler nathan at yergler.net
Tue Mar 30 09:13:55 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/event
In directory cvs.zope.org:/tmp/cvs-serv1917/src/zope/app/event

Modified Files:
	configure.zcml objectevent.py 
Log Message:


Merging observable-branch 
(added subscriber ZCML directive.)




=== Zope3/src/zope/app/event/configure.zcml 1.8 => 1.9 ===
--- Zope3/src/zope/app/event/configure.zcml:1.8	Thu Mar 11 03:14:02 2004
+++ Zope3/src/zope/app/event/configure.zcml	Tue Mar 30 09:13:24 2004
@@ -28,6 +28,9 @@
     subscriber=".objectevent.objectEventNotifierInstance"
     event_types="zope.app.event.interfaces.IObjectEvent" />
 
+<event:subscribe
+    subscriber=".objectevent.observerEventNotifierInstance"
+    event_types="zope.app.event.interfaces.IObjectEvent" />
 
 <!-- Local Event Service -->
 <content class=".localservice.EventService">


=== Zope3/src/zope/app/event/objectevent.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/event/objectevent.py:1.12	Mon Mar 15 15:41:42 2004
+++ Zope3/src/zope/app/event/objectevent.py	Tue Mar 30 09:13:24 2004
@@ -24,6 +24,7 @@
 from zope.app.event.interfaces import IObjectAnnotationsModifiedEvent
 from zope.app.event.interfaces import IObjectContentModifiedEvent
 from zope.app.event.interfaces import ISubscriber
+from zope.app.observable.interfaces import IObservable
 from zope.interface import implements
 from zope.app.event import publish
 from zope.app import zapi
@@ -85,6 +86,17 @@
 
 objectEventNotifierInstance = ObjectEventNotifier()
 
+class ObserverEventNotifier:
+
+    implements(ISubscriber)
+
+    def notify (self, event):
+        adapter = IObservable(event.object, None)
+
+        if adapter is not None:
+            adapter.notify(event, ISubscriber)
+
+observerEventNotifierInstance = ObserverEventNotifier()
 
 def objectEventCallbackHelper(callback):
     """Build a factory implementing ISubscriber that just calls a callback




More information about the Zope3-Checkins mailing list