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

Fred L. Drake, Jr. fred@zope.com
Mon, 23 Jun 2003 18:08:28 -0400


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

Modified Files:
      Tag: fdrake-zconfig-in-zope-3-branch
	undo.py undo.zcml 
Log Message:
Support ZConfig in Zope 3.

=== Zope3/src/zope/app/browser/undo.py 1.4 => 1.4.4.1 ===
--- Zope3/src/zope/app/browser/undo.py:1.4	Fri Jun  6 17:35:15 2003
+++ Zope3/src/zope/app/browser/undo.py	Mon Jun 23 18:07:57 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.1.32.1 ===
--- Zope3/src/zope/app/browser/undo.zcml:1.1	Fri Feb  7 10:48:36 2003
+++ Zope3/src/zope/app/browser/undo.zcml	Mon Jun 23 18:07:57 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>