[Zope3-checkins] CVS: Zope3/src/zope/app/browser - undo.py:1.5 undo.zcml:1.2

Fred L. Drake, Jr. fred@zope.com
Wed, 25 Jun 2003 11:24:20 -0400


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

Modified Files:
	undo.py undo.zcml 
Log Message:
Merged from fdrake-zconfig-in-zope-3-branch:
Register a startup event to take care of setting up the undo manager.


=== Zope3/src/zope/app/browser/undo.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/undo.py:1.4	Fri Jun  6 17:35:15 2003
+++ Zope3/src/zope/app/browser/undo.py	Wed Jun 25 11:24:20 2003
@@ -17,10 +17,20 @@
 $Id$
 """
 from zope.interface import implements
-from zope.component import getUtility
+from zope.component import getService, getUtility
 from zope.publisher.browser import BrowserView
+from zope.app.event import function
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.interfaces.undo import IUndoManager
+from zope.app.services.servicenames import Utilities
+
+
+def undoSetup(event):
+    # setup undo fnctionality
+    svc = getService(None, Utilities)
+    svc.provideUtility(IUndoManager, ZODBUndoManager(event.database))
+
+undoSetup = function.Subscriber(undoSetup)
 
 
 class ZODBUndoManager:


=== Zope3/src/zope/app/browser/undo.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/undo.zcml:1.1	Fri Feb  7 10:48:36 2003
+++ Zope3/src/zope/app/browser/undo.zcml	Wed Jun 25 11:24:20 2003
@@ -1,4 +1,5 @@
-<zopeConfigure xmlns="http://namespaces.zope.org/browser">
+<zopeConfigure xmlns="http://namespaces.zope.org/browser"
+               xmlns:event="http://namespaces.zope.org/event">
 
 <!-- Undo -->
 
@@ -16,6 +17,11 @@
       menu="zmi_actions"
       title="Undo"
       action="@@undoForm.html"
+      />
+
+  <event:subscribe
+      subscriber=".undo.undoSetup"
+      event_types="zope.app.interfaces.event.IDatabaseOpenedEvent"
       />
 
 </zopeConfigure>