[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_dtmlpage.py:1.5.26.1 test_sqlscript.py:1.14.6.1 test_zptpage.py:1.13.8.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:06 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/content/tests
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/content/tests

Modified Files:
      Tag: parentgeddon-branch
	test_dtmlpage.py test_sqlscript.py test_zptpage.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/content/tests/test_dtmlpage.py 1.5 => 1.5.26.1 ===
--- Zope3/src/zope/app/content/tests/test_dtmlpage.py:1.5	Tue May 27 10:18:14 2003
+++ Zope3/src/zope/app/content/tests/test_dtmlpage.py	Mon Sep  8 14:21:35 2003
@@ -26,8 +26,8 @@
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
 from zope.app.interfaces.traversing import ITraverser, ITraversable
 from zope.component.adapter import provideAdapter
-from zope.context import Wrapper
 from zope.security.checker import NamesChecker, defineChecker
+from zope.app.container.contained import contained
 
 
 class Data(object):
@@ -58,7 +58,7 @@
             '</a></body></html>'
             )
 
-        page = Wrapper(page, Data(name='zope'))
+        page = contained(page, Data(name='zope'))
 
         out = page.render(Data(URL={'1': 'http://foo.com/'}),
                           title="Zope rules")


=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.14 => 1.14.6.1 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.14	Tue Aug 19 13:34:15 2003
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py	Mon Sep  8 14:21:35 2003
@@ -22,7 +22,7 @@
 from zope.app.interfaces.rdb import IZopeConnection
 from zope.app.interfaces.rdb import IZopeCursor
 from zope.component import getService
-from zope.app.services.servicenames import Adapters
+from zope.app.services.servicenames import Adapters, Utilities
 from zope.app.component import nextservice
 from zope.component.service import serviceManager as sm
 from zope.app.tests.placelesssetup import PlacelessSetup
@@ -100,16 +100,6 @@
         return self.cache.get((obj, keywords), default)
 
 
-class CachingServiceStub:
-
-    implements(ICachingService, ISimpleService)
-
-    def __init__(self):
-        self.caches = {}
-
-    def getCache(self, name):
-        return self.caches[name]
-
 class LocatableStub:
 
     implements(IPhysicallyLocatable)
@@ -133,9 +123,6 @@
         sm.provideService('SQLDatabaseConnections', ConnectionServiceStub())
         self._old_getNextServiceManager = nextservice.getNextServiceManager
         nextservice.getNextServiceManager = getNextServiceManager
-        self.caching_service = CachingServiceStub()
-        sm.defineService('Caching', ICachingService)
-        sm.provideService('Caching', self.caching_service)
         getService(None, Adapters).provideAdapter(
             IAttributeAnnotatable, IAnnotations,
             AttributeAnnotations)
@@ -201,7 +188,10 @@
         self.assertEqual(result[0].counter, 2)
         # caching: and check that the counter stays still
         AnnotationCacheable(script).setCacheId('dumbcache')
-        self.caching_service.caches['dumbcache'] = CacheStub()
+
+
+        getService(None, Utilities).provideUtility(
+            ICache, CacheStub(), 'dumbcache')
         result = script(id=1)
         self.assertEqual(result[0].counter, 3)
         result = script(id=1)


=== Zope3/src/zope/app/content/tests/test_zptpage.py 1.13 => 1.13.8.1 ===
--- Zope3/src/zope/app/content/tests/test_zptpage.py:1.13	Wed Aug  6 10:45:14 2003
+++ Zope3/src/zope/app/content/tests/test_zptpage.py	Mon Sep  8 14:21:35 2003
@@ -37,9 +37,9 @@
 from zope.app.interfaces.traversing import ITraverser
 from zope.app.interfaces.traversing import ITraversable
 from zope.component.adapter import provideAdapter
-from zope.app.context import ContextWrapper
-from zope.context import Wrapper, getInnerWrapperData
 from zope.security.checker import NamesChecker, defineChecker
+from zope.app.container.contained import contained
+
 
 class Data(object):
     def __init__(self, **kw):
@@ -85,7 +85,7 @@
             '</a></body></html>'
             )
 
-        page = Wrapper(page, Data(name='zope'))
+        page = contained(page, Data(name='zope'))
 
         out = page.render(Data(URL={'1': 'http://foo.com/'}),
                           title="Zope rules")
@@ -105,7 +105,7 @@
             u'<p tal:content="python: request.__dict__" />'
             )
 
-        page = Wrapper(page, Data(name='zope'))
+        page = contained(page, Data(name='zope'))
 
         self.assertRaises(Forbidden, page.render, Data())
 
@@ -113,8 +113,10 @@
 
         class AU(BrowserView):
             def __str__(self):
-                dict = getInnerWrapperData(self.context)
-                return str(dict and dict.get('name') or None)
+                name = self.context.__name__
+                if name is None:
+                    return 'None'
+                return name
 
         from zope.app.traversing.namespace import provideNamespaceHandler
         from zope.app.traversing.namespace import view
@@ -125,7 +127,7 @@
         page.setSource(
             u'<p tal:replace="template/@@name" />'
             )
-        page = ContextWrapper(page, None, name='zpt')
+        page = contained(page, None, name='zpt')
         request = TestRequest()
         request.setViewType(IBrowserPresentation)
         self.assertEquals(page.render(request), 'zpt\n')




More information about the Zope3-Checkins mailing list