[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testZopePublication.py:1.1.2.27.2.2

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


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

Modified Files:
      Tag: Zope3InWonderland-branch
	testZopePublication.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/ZopePublication/tests/testZopePublication.py 1.1.2.27.2.1 => 1.1.2.27.2.2 ===
 from Zope.Publisher.Publish import publish
 from Zope.Publisher.Browser.BrowserRequest import TestRequest
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.App.ZopePublication.ZopePublication import ZopePublication
 from Zope.App.ZopePublication.Browser.Publication import BrowserPublication
 from Zope.Configuration.name import resolve
 from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
+from Zope.Publisher.Browser.IBrowserPresentation import IBrowserPresentation
 from Zope.Publisher.DefaultPublication import TestPublication
 from Zope.Publisher.IPublication import IPublication
 from Zope.Proxy.ContextWrapper import getWrapperContext
@@ -63,12 +65,9 @@
     def browserDefault(self, request):
         return self, ['bruce']
 
-class DummyView(DummyPublished):
+class DummyView(DummyPublished, BrowserView):
 
-    __implements__ = IBrowserPublisher
-    
-    def __init__(self, context, request):
-        self.context = context
+    __implements__ = DummyPublished.__implements__, BrowserView.__implements__
 
 
 class BasePublicationTests(PlacelessSetup, unittest.TestCase):
@@ -117,25 +116,25 @@
     test browser default
 
     many views lead to a default view
-    <base href="/somepath/view;view/view_method">
+    <base href="/somepath/view::view/view_method">
 
     """
     klass = BrowserPublication
     
     def testBaseTagNoBase(self):
-        self._testBaseTags('/somepath/view;view/', '')
+        self._testBaseTags('/somepath/view::view/', '')
 
     def testBaseTag1(self):
-        self._testBaseTags('/somepath/view;view',
-                           'http://127.0.0.1/somepath/view;view/bruce')
+        self._testBaseTags('/somepath/view::view',
+                           'http://127.0.0.1/somepath/view::view/bruce')
 
     def testBaseTag2(self):
         self._testBaseTags('/somepath/',
-                           'http://127.0.0.1/somepath/view;view/bruce')
+                           'http://127.0.0.1/somepath/view::view/bruce')
 
     def testBaseTag3(self):
         self._testBaseTags('/somepath',
-                           'http://127.0.0.1/somepath/view;view/bruce')
+                           'http://127.0.0.1/somepath/view::view/bruce')
         
 
 
@@ -152,11 +151,11 @@
         pub = BrowserPublication(self.db)
         
         getService(None,'Views').provideView(I1, 'view',
-                           IBrowserPublisher, [DummyView])
+                           IBrowserPresentation, [DummyView])
         getService(None,'Views').setDefaultViewName(I1,
-                             IBrowserPublisher, 'view')
+                             IBrowserPresentation, 'view')
         getService(None, 'Views').provideView(None,
-                    '_traverse', IBrowserPublisher, [TestTraverser])
+                    '_traverse', IBrowserPresentation, [TestTraverser])
         
         ob = O1()
 
@@ -229,7 +228,7 @@
                 return self.context[name]
 
         provideView=getService(None, "Views").provideView
-        provideView(I1, '_traverse', IBrowserPublisher, [Adapter])
+        provideView(I1, '_traverse', IBrowserPresentation, [Adapter])
         ob = mydict()
         ob['bruce'] =  SimpleObject('bruce')
         ob['bruce2'] =  SimpleObject('bruce2')
@@ -252,7 +251,7 @@
                 return (self.context['bruce'], 'dummy')
 
         provideView=getService(None, "Views").provideView
-        provideView(I1, '_traverse', IBrowserPublisher, [Adapter])
+        provideView(I1, '_traverse', IBrowserPresentation, [Adapter])
         ob = mydict()
         ob['bruce'] =  SimpleObject('bruce')
         ob['bruce2'] =  SimpleObject('bruce2')
@@ -272,15 +271,15 @@
         pub = self.klass(self.db)
         ob = C()
         provideView=getService(None, "Views").provideView
-        provideView(I1, 'edit', IBrowserPublisher, [BobView])
+        provideView(I1, 'edit', IBrowserPresentation, [BobView])
 
-        r = self._createRequest('/edit;skin=zmi;view',pub)
-        ob2 = pub.traverseName(r , ob, 'edit;skin=zmi;view')
+        r = self._createRequest('/view::edit;skin=zmi',pub)
+        ob2 = pub.traverseName(r , ob, 'view::edit;skin=zmi')
         self.assertEqual(r.getPresentationSkin(), 'zmi')
         self.assertEqual(ob2.__class__ , BobView)
 
-        r = self._createRequest('/edit;view;skin=zmi',pub)
-        ob2 = pub.traverseName(r , ob, 'edit;view;skin=zmi')
+        r = self._createRequest('/view::edit;skin=zmi',pub)
+        ob2 = pub.traverseName(r , ob, 'view::edit;skin=zmi')
         self.assertEqual(r.getPresentationSkin(), 'zmi')
         self.assertEqual(ob2.__class__ , BobView)
 
@@ -291,7 +290,7 @@
         ob = C()
         r = self._createRequest('/x',pub)
         provideView=getService(None, "Views").provideView
-        provideView(None, '_traverse', IBrowserPublisher, [TestTraverser])
+        provideView(None, '_traverse', IBrowserPresentation, [TestTraverser])
         ob2 = pub.traverseName(r, ob, 'x')
         self.assertEqual(removeAllProxies(ob2).v, 1)
         self.assertEqual(getWrapperContext(ob2), ob)
@@ -304,11 +303,11 @@
         ob = C()
         class V:
             def __init__(self, context, request): pass
-            __implements__ = IBrowserPublisher
-        r = self._createRequest('/spam;view',pub)
+            __implements__ = IBrowserPresentation
+        r = self._createRequest('/view::spam',pub)
         provideView=getService(None, "Views").provideView
-        provideView(I, 'spam', IBrowserPublisher, [V])
-        ob2 = pub.traverseName(r, ob, 'spam;view')
+        provideView(I, 'spam', IBrowserPresentation, [V])
+        ob2 = pub.traverseName(r, ob, 'view::spam')
         self.assertEqual(removeAllProxies(ob2).__class__, V)
         self.assertEqual(getWrapperContext(ob2), ob)
 
@@ -318,8 +317,8 @@
             def getServiceManager(self):
                 return SimpleObject(1)
         ob = C()
-        r = self._createRequest('/Services;etc',pub)
-        ob2 = pub.traverseName(r, ob, 'Services;etc')
+        r = self._createRequest('/etc::Services',pub)
+        ob2 = pub.traverseName(r, ob, 'etc::Services')
         self.assertEqual(removeAllProxies(ob2).v, 1)
         self.assertEqual(getWrapperContext(ob2), ob)
 
@@ -327,10 +326,10 @@
         from Zope.App.OFS.ApplicationControl.ApplicationControl \
              import ApplicationController
         pub = self.klass(self.db)
-        r = self._createRequest('/ApplicationController;etc;skin=zmi',pub)
-        ac = pub.traverseName(r, None, 'ApplicationController;etc;skin=zmi')
+        r = self._createRequest('/etc::ApplicationController;skin=zmi',pub)
+        ac = pub.traverseName(r, None, 'etc::ApplicationController;skin=zmi')
         self.assertEqual(ac, ApplicationController)
-        r = self._createRequest('/ApplicationController;etc;skin=zmi',pub)
+        r = self._createRequest('/etc::ApplicationController;skin=zmi',pub)
         app = r.getPublication().getApplication(r)
         self.assertEqual(app, ApplicationController)
         self.failIf(r.getTraversalStack())