[Zope3-checkins] CVS: Zope3/src/zope/app/presentation - configure.zcml:1.5 presentation.py:1.11

Maru Newby maru at thesprawl.net
Mon Mar 22 19:23:41 EST 2004


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

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


Replaced implementation of IRemoveNotifiable and IAddedNotifiable with object
subscribers for object remove and add events on PageRegistration objects.




=== Zope3/src/zope/app/presentation/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/presentation/configure.zcml:1.4	Sat Mar 13 13:01:15 2004
+++ Zope3/src/zope/app/presentation/configure.zcml	Mon Mar 22 19:23:10 2004
@@ -39,6 +39,20 @@
       />
 </content>
 
+<subscriber
+    factory=".presentation.PageRegistrationAddSubscriber"
+    for=".presentation.IPageRegistration 
+         zope.app.container.interfaces.IObjectAddedEvent"
+    provides="zope.app.event.interfaces.ISubscriber"    
+    />
+
+<subscriber
+    factory=".presentation.PageRegistrationRemoveSubscriber"
+    for=".presentation.IPageRegistration 
+         zope.app.container.interfaces.IObjectRemovedEvent"
+    provides="zope.app.event.interfaces.ISubscriber"    
+    />
+
 <modulealias module="zope.app.presentation.presentation"
              alias="zope.app.services.presentation"
              />


=== Zope3/src/zope/app/presentation/presentation.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/presentation/presentation.py:1.10	Mon Mar 15 15:41:44 2004
+++ Zope3/src/zope/app/presentation/presentation.py	Mon Mar 22 19:23:10 2004
@@ -24,6 +24,7 @@
 import zope.app.component.interfacefield
 import zope.app.component.nextservice
 import zope.app.container.contained
+import zope.app.event.interfaces
 import zope.app.registration.interfaces
 import zope.app.site.interfaces
 import zope.app.adapter
@@ -36,7 +37,6 @@
 import zope.proxy
 import zope.publisher.interfaces.browser
 import zope.schema
-from zope.app.container.interfaces import IAddNotifiable
 from zope.app.dependable.interfaces import IDependable, DependencyError
 from zope.app.registration.interfaces import IRegistered
 
@@ -396,7 +396,7 @@
 
 class PageRegistration(ViewRegistration):
 
-    zope.interface.implements(IPageRegistration, IAddNotifiable)
+    zope.interface.implements(IPageRegistration)
 
     # We only care about browser pages
     requestType = zope.publisher.interfaces.browser.IBrowserRequest
@@ -487,8 +487,16 @@
     factory = property(factory)
 
 
-    def addNotify(self, event):
-        "See IAddNotifiable"
+class PageRegistrationAddSubscriber:
+
+    zope.interface.implements(zope.app.event.interfaces.ISubscriber)
+
+    def __init__(self, page_registration, event):
+        self.page_registration = page_registration
+        self.event = event
+        
+    def notify(self, event):
+        self = self.page_registration
         if self.template:
             template = zapi.traverse(self.__parent__.__parent__,self.template)
             dependents = IDependable(template)
@@ -500,9 +508,16 @@
                 adapter.addUsage(objectpath)
 
 
-    def removeNotify(self, event):
-        "See IRemoveNotifiable"
-        super(PageRegistration, self).removeNotify(event)
+class PageRegistrationRemoveSubscriber:
+
+    zope.interface.implements(zope.app.event.interfaces.ISubscriber)
+
+    def __init__(self, page_registration, event):
+        self.page_registration = page_registration
+        self.event = event
+
+    def notify(self, event):
+        self = self.page_registration
         if self.template:
             template = zapi.traverse(self.__parent__.__parent__,self.template)
             dependents = IDependable(template)




More information about the Zope3-Checkins mailing list