[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI/tests - testZMIViewUtility.py:1.1.2.11.2.2

Jim Fulton jim@zope.com
Sun, 2 Jun 2002 10:35:25 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI/tests
In directory cvs.zope.org:/tmp/cvs-serv29793/lib/python/Zope/App/ZMI/tests

Modified Files:
      Tag: Zope3InWonderland-branch
	testZMIViewUtility.py 
Log Message:
- Added template attribute to allow views to be created from a
  template source file.

- Added beginnings of a Zope debugger. This required seperating site
  and server configuration.

- Added the ability to specify a config file package in the
  zopeConfigure directive. Made "config.zcml" a default for the file
  attribute in the include directive.

- Fixed mapply to unwrap proxied objects. This was necessary once
  views became wrapped in proxies. We need to investigate why they
  weren't being wrapped before. 

- I updated enough system page templates and zcml directives so that:

  - Zope now starts. :)

  - The root folder contents listing can be viewed.

  Many more templates and zcml files need to be updated to reflect the
  way views are now handled.



=== Zope3/lib/python/Zope/App/ZMI/tests/testZMIViewUtility.py 1.1.2.11.2.1 => 1.1.2.11.2.2 ===
            import PlacefulSetup
 from Zope.App.ZMI.ZMIViewUtility import ZMIViewUtility
-from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
+from Zope.Publisher.Browser.IBrowserView import IBrowserView
+from Zope.Publisher.Browser.IBrowserPresentation import IBrowserPresentation
 from Zope.App.ZopePublication.Traversers import TestTraverser
 from Zope.Security.SecurityManagement import setSecurityPolicy
 from Zope.Security.SecurityManagement import newSecurityManager
@@ -39,7 +40,7 @@
         return [('l1', 'a1'),
                 ('l2', 'a2/a3'),
                 ('lbad', 'abad'),
-                ('l3', 'a3;view'),]
+                ('l3', 'view::a3'),]
 
 class I(Interface): pass
 class C:
@@ -53,8 +54,11 @@
 ob.abad.bad=1
 
 class V:
-    def __init__(self, context, request): pass
-    __implements__ = IBrowserPublisher
+    __implements__ = IBrowserView
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
 
 
 class Test(PlacefulSetup, unittest.TestCase):
@@ -65,9 +69,10 @@
         provideService=getServiceManager(None).provideService
         defineService('ZMIViewService', IZMIViewService)
         provideService('ZMIViewService', Service())
-        getService(None,"Views").provideView(I, 'a3', IBrowserPublisher, [V])
+        getService(None,"Views").provideView(
+            I, 'a3', IBrowserPresentation, [V])
         getService(None, "Views").provideView(None, '_traverse',
-                            IBrowserPublisher, [TestTraverser])
+                            IBrowserPresentation, [TestTraverser])
         defineChecker(C, NamesChecker(['a1', 'a2', 'a3'], CheckerPublic,
                                       abad='waaa'))
 
@@ -77,12 +82,12 @@
         self.assertEqual(v.getZMIViews(),
                          [{'label':'l1', 'action':'../a1'},
                           {'label':'l2', 'action':'../a2/a3'},
-                          {'label':'l3', 'action':'../a3;view'}
+                          {'label':'l3', 'action':'../view::a3'}
                           ])
 
 class Request:
     def getPresentationType(self):
-        return IBrowserPublisher
+        return IBrowserPresentation
     def getPresentationSkin(self):
         return ''