[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests -
iregistry.py:1.1.26.1 placefulsetup.py:1.27.10.1
test_adapter.py:1.21.6.1 test_eventservice.py:1.27.24.1
test_modulelookup.py:1.3.18.1 test_nameregistry.py:1.1.26.1
test_objecthub.py:1.12.8.1 test_pagefolder.py:1.7.18.1
test_registrationmanager.py:1.2.6.1 test_registrations.py:1.2.24.1
test_registrationstack.py:1.2.18.1
test_registrationstatusproperty.py:1.3.2.1
test_servicemanager.py:1.15.2.1 test_utility.py:1.10.8.1
test_view.py:1.22.2.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:21 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/services/tests
Modified Files:
Tag: parentgeddon-branch
iregistry.py placefulsetup.py test_adapter.py
test_eventservice.py test_modulelookup.py test_nameregistry.py
test_objecthub.py test_pagefolder.py
test_registrationmanager.py test_registrations.py
test_registrationstack.py test_registrationstatusproperty.py
test_servicemanager.py test_utility.py test_view.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/services/tests/iregistry.py 1.1 => 1.1.26.1 ===
--- Zope3/src/zope/app/services/tests/iregistry.py:1.1 Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/iregistry.py Mon Sep 8 14:21:49 2003
@@ -19,7 +19,6 @@
"""
from zope.app.interfaces.services.registration import IRegistry
from zope.interface.verify import verifyObject
-from zope.context import getWrapperContainer
class TestingIRegistry:
"""Base class for testing implementors of IRegistry
@@ -44,8 +43,8 @@
have some context.
"""
- self.assertEqual(getWrapperContainer(ob), parent)
- self.failIf(getWrapperContainer(getWrapperContainer(ob)) is None)
+ self.assertEqual(ob.__parent__, parent)
+ self.failIf(ob.__parent__.__parent__ is None)
def test_implements_IRegistry(self):
verifyObject(IRegistry, self.createTestingRegistry())
@@ -64,7 +63,7 @@
registration = self.createTestingRegistration()
stack = registry.createRegistrationsFor(registration)
- self.assertEqual(getWrapperContainer(stack), registry)
+ self.assertEqual(stack.__parent__, registry)
# If we call it again, we should get the same object
self.assertEqual(registry.createRegistrationsFor(registration),
=== Zope3/src/zope/app/services/tests/placefulsetup.py 1.27 => 1.27.10.1 ===
--- Zope3/src/zope/app/services/tests/placefulsetup.py:1.27 Thu Jul 31 17:35:16 2003
+++ Zope3/src/zope/app/services/tests/placefulsetup.py Mon Sep 8 14:21:49 2003
@@ -19,7 +19,6 @@
from zope.app.tests import setup
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.content.folder import RootFolder
-from zope.app.context import ContextWrapper
class Place(object):
@@ -36,7 +35,6 @@
except KeyError:
root = inst.rootFolder = setup.buildSampleFolderTree()
- root = ContextWrapper(root, None)
return zapi.traverse(root, self.path)
class PlacefulSetup(PlacelessSetup):
=== Zope3/src/zope/app/services/tests/test_adapter.py 1.21 => 1.21.6.1 ===
--- Zope3/src/zope/app/services/tests/test_adapter.py:1.21 Sun Aug 17 02:08:20 2003
+++ Zope3/src/zope/app/services/tests/test_adapter.py Mon Sep 8 14:21:49 2003
@@ -20,7 +20,6 @@
from zope.app.services.tests.iregistry import TestingIRegistry
from zope.app.services.adapter import AdapterService
from zope.interface import Interface, directlyProvides, implements
-from zope.app.context import ContextWrapper
from zope.component.exceptions import ComponentLookupError
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.services.adapter import AdapterRegistration
@@ -46,6 +45,10 @@
pass
+def contained(o1, o2):
+ o1.__parent__ = o2
+ return o1
+
class Registration:
forInterface = I1
providedInterface = I2
@@ -68,7 +71,8 @@
def setUp(self):
PlacefulSetup.setUp(self, site=True)
- self._service = ContextWrapper(AdapterService(), self.rootFolder)
+ self._service = AdapterService()
+ self._service.__parent__ = self.rootFolder
def test_implements_IAdapterService(self):
from zope.component.interfaces import IAdapterService
@@ -77,7 +81,7 @@
verifyObject(IAdapterService, self._service)
def createTestingRegistry(self):
- return ContextWrapper(AdapterService(), C())
+ return contained(AdapterService(), C())
def createTestingRegistration(self):
return Registration()
@@ -170,8 +174,8 @@
registration_manager = traverse(sm, 'default').getRegistrationManager()
registration = Registration()
registration.adapterName = u"Yatta!"
- registration_manager.setObject('', registration)
- registration = traverse(registration_manager, '1')
+ key = registration_manager.setObject('', registration)
+ registration = traverse(registration_manager, key)
class O:
implements(I1)
@@ -276,9 +280,9 @@
def test_getAdapter(self):
folder = ModuleFinder()
- folder = ContextWrapper(folder, folder)
+ folder = contained(folder, folder)
- registration = ContextWrapper(
+ registration = contained(
AdapterRegistration(I1, I2, "Foo.Bar.A", "adapter"),
folder,
)
=== Zope3/src/zope/app/services/tests/test_eventservice.py 1.27 => 1.27.24.1 ===
--- Zope3/src/zope/app/services/tests/test_eventservice.py:1.27 Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/test_eventservice.py Mon Sep 8 14:21:49 2003
@@ -33,7 +33,6 @@
from zope.app.event.objectevent import ObjectAddedEvent, ObjectModifiedEvent
from zope.app.interfaces.event import IEvent, ISubscribingAware
from zope.app.interfaces.services.registration import RegisteredStatus
-from zope.app.context import ContextWrapper
from zope.app.services.tests.eventsetup import EventSetup
from zope.component.tests.components import RecordingAdapter
from zope.component.adapter import provideAdapter
@@ -128,20 +127,11 @@
def _createSubscribers(self):
self.rootFolder.setObject("rootFolderSubscriber", DummySubscriber())
- self.rootFolderSubscriber = ContextWrapper(
- self.rootFolder["rootFolderSubscriber"],
- self.rootFolder,
- name="rootFolderSubscriber")
+ self.rootFolderSubscriber = self.rootFolder["rootFolderSubscriber"]
self.folder1.setObject("folder1Subscriber", DummySubscriber())
- self.folder1Subscriber = ContextWrapper(
- self.folder1["folder1Subscriber"],
- self.folder1,
- name="folder1Subscriber")
+ self.folder1Subscriber = self.folder1["folder1Subscriber"]
self.folder1_1.setObject("folder1_1Subscriber", DummySubscriber())
- self.folder1_1Subscriber = ContextWrapper(
- self.folder1_1["folder1_1Subscriber"],
- self.folder1_1,
- name="folder1_1Subscriber")
+ self.folder1_1Subscriber = self.folder1_1["folder1_1Subscriber"]
def _createHubIdSubscribers(self):
self._createSubscribers()
@@ -830,10 +820,7 @@
def _createAlternateService(self, service):
self.folder2.setObject("folder2Subscriber", DummySubscriber())
- self.folder2Subscriber = ContextWrapper(
- self.folder2["folder2Subscriber"],
- self.folder2,
- name="folder2Subscriber")
+ self.folder2Subscriberself.folder2["folder2Subscriber"]
sm = self.makeSite('folder2')
setup.addService(sm, EventPublication, service);
@@ -924,10 +911,7 @@
self.rootFolder.setObject(
"mySubscriber",
HasSubscribingAwareAdapter())
- self.mySubscriber = ContextWrapper(
- self.rootFolder["mySubscriber"],
- self.rootFolder,
- name="mySubscriber")
+ self.mySubscriber = self.rootFolder["mySubscriber"]
filter = DummyFilter()
subscribe(
self.mySubscriber,
=== Zope3/src/zope/app/services/tests/test_modulelookup.py 1.3 => 1.3.18.1 ===
--- Zope3/src/zope/app/services/tests/test_modulelookup.py:1.3 Thu Jul 3 11:42:48 2003
+++ Zope3/src/zope/app/services/tests/test_modulelookup.py Mon Sep 8 14:21:49 2003
@@ -20,7 +20,6 @@
"""
from zope.testing.doctestunit import DocTestSuite
-from zope.context import Wrapper
from zope.app.services.registration import RegistrationManagerContainer
from zope.app.interfaces.services.module import IModuleManager
@@ -52,7 +51,7 @@
>>> next = MyFolder()
>>> next['m3'] = MyModuleManager(3)
>>> next['z.y.m4'] = MyModuleManager(4)
- >>> folder = Wrapper(folder, next)
+ >>> folder.__parent__ = next
>>> folder.findModule('m1')
1
=== Zope3/src/zope/app/services/tests/test_nameregistry.py 1.1 => 1.1.26.1 ===
--- Zope3/src/zope/app/services/tests/test_nameregistry.py:1.1 Sat Jun 21 17:22:13 2003
+++ Zope3/src/zope/app/services/tests/test_nameregistry.py Mon Sep 8 14:21:49 2003
@@ -20,8 +20,6 @@
from zope.app.services.registration import NameRegistry
from zope.app.services.registration import NameComponentRegistry
-from zope.app.context import ContextWrapper
-from zope.context import getWrapperContainer
class RegistrationStub:
@@ -49,7 +47,8 @@
def setUp(self):
self.container = object()
- self.subject = ContextWrapper(NameRegistry(), self.container)
+ self.subject = NameRegistry()
+ self.subject.__parent__ = self.container
def test_queryRegistrationsFor(self):
subject = self.subject
@@ -61,8 +60,8 @@
subject._bindings["Foo"] = registry
result = subject.queryRegistrationsFor(cfg)
self.assertEquals(result, registry)
- self.assertEquals(getWrapperContainer(result), subject)
- self.assertEquals(getWrapperContainer(getWrapperContainer(result)),
+ self.assertEquals(result.__parent__, subject)
+ self.assertEquals(result.__parent__.__parent__,
self.container)
def test_queryRegistrations(self):
@@ -74,9 +73,8 @@
subject._bindings["Foo"] = registry
result = subject.queryRegistrations("Foo")
self.assertEquals(result, registry)
- self.assertEquals(getWrapperContainer(result), subject)
- self.assertEquals(getWrapperContainer(getWrapperContainer(result)),
- self.container)
+ self.assertEquals(result.__parent__, subject)
+ self.assertEquals(result.__parent__.__parent__, self.container)
def test_createRegistrationsFor(self):
subject = self.subject
@@ -89,9 +87,8 @@
self.assertNotEquals(r1, r2)
self.assertNotEquals(r2, r3)
self.assertEquals(r3, subject._bindings['Foo'])
- self.assertEquals(getWrapperContainer(r3), subject)
- self.assertEquals(getWrapperContainer(getWrapperContainer(r3)),
- self.container)
+ self.assertEquals(r3.__parent__, subject)
+ self.assertEquals(r3.__parent__.__parent__, self.container)
self.failUnless(subject._p_changed)
def test_createRegistrations(self):
@@ -103,9 +100,8 @@
self.assertNotEquals(r1, r2)
self.assertNotEquals(r2, r3)
self.assertEquals(r3, subject._bindings['Foo'])
- self.assertEquals(getWrapperContainer(r3), subject)
- self.assertEquals(getWrapperContainer(getWrapperContainer(r3)),
- self.container)
+ self.assertEquals(r3.__parent__, subject)
+ self.assertEquals(r3.__parent__.__parent__, self.container)
self.failUnless(subject._p_changed)
def test_listRegistrationNames(self):
@@ -120,8 +116,8 @@
def setUp(self):
self.container = object()
- self.subject = ContextWrapper(NameComponentRegistry(),
- self.container)
+ self.subject = NameComponentRegistry()
+ self.subject.__parent__ = self.container
def test_queryActiveComponent(self):
subject = self.subject
=== Zope3/src/zope/app/services/tests/test_objecthub.py 1.12 => 1.12.8.1 ===
--- Zope3/src/zope/app/services/tests/test_objecthub.py:1.12 Thu Aug 7 11:32:47 2003
+++ Zope3/src/zope/app/services/tests/test_objecthub.py Mon Sep 8 14:21:49 2003
@@ -40,7 +40,6 @@
from zope.exceptions import NotFoundError
from zope.app.traversing import canonicalPath, traverse
-from zope.context import Wrapper
from zope.interface import implements
@@ -546,11 +545,11 @@
def setUp(self):
ObjectHubSetup.setUp(self)
- self.rootFolder.setObject('deleted', self.obj)
- self.deleted_obj = Wrapper(object(), self.rootFolder, name='deleted')
+ self.rootFolder.setObject('deleted', object())
+ self.deleted_obj = self.rootFolder['deleted']
self.deleted_path = '/deleted'
- self.rootFolder.setObject('valid', self.obj)
- self.valid_obj = Wrapper(object(), self.rootFolder, name='valid')
+ self.rootFolder.setObject('valid', object())
+ self.valid_obj = self.rootFolder['valid']
self.valid_path = '/valid'
# register the objects
=== Zope3/src/zope/app/services/tests/test_pagefolder.py 1.7 => 1.7.18.1 ===
--- Zope3/src/zope/app/services/tests/test_pagefolder.py:1.7 Wed Jul 2 18:11:08 2003
+++ Zope3/src/zope/app/services/tests/test_pagefolder.py Mon Sep 8 14:21:49 2003
@@ -19,9 +19,8 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app.tests import setup
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.services.pagefolder import PageFolder, PageFolderContextDecorator
+from zope.app.services.pagefolder import PageFolder
from zope.app.interfaces.services.pagefolder import IPageFolder
-from zope.app.interfaces.context import IZopeContextWrapper
from zope.app.traversing import traverse
from zope.app.services.zpt import ZPTTemplate
from zope.app.services.view import ViewService
@@ -42,8 +41,6 @@
def setUp(self):
sm = PlacefulSetup.setUp(self, site=True)
- provideAdapter(IPageFolder, IZopeContextWrapper,
- PageFolderContextDecorator)
setup.addService(sm, 'Views', ViewService(), suffix='service')
default = traverse(self.rootFolder, '++etc++site/default')
default.setObject('Views', PageFolder())
=== Zope3/src/zope/app/services/tests/test_registrationmanager.py 1.2 => 1.2.6.1 ===
--- Zope3/src/zope/app/services/tests/test_registrationmanager.py:1.2 Sun Aug 17 02:08:20 2003
+++ Zope3/src/zope/app/services/tests/test_registrationmanager.py Mon Sep 8 14:21:49 2003
@@ -16,7 +16,7 @@
"""
from unittest import TestCase, main, makeSuite
-from zope.app.interfaces.container import IDeleteNotifiable, IZopeContainer
+from zope.app.interfaces.container import IDeleteNotifiable
from zope.app.interfaces.services.registration import IRegistrationManager
from zope.app.services.registration import RegistrationManager
from zope.app.services.tests import placefulsetup
@@ -25,7 +25,6 @@
from zope.interface.common.tests.basemapping import BaseTestIEnumerableMapping
from zope.interface.verify import verifyObject
from zope.interface import implements
-from zope.app.context import ContextWrapper
class Undeletable:
@@ -332,7 +331,6 @@
def test_manageBeforeDelete(self):
container = []
manager = RegistrationManager()
- manager = ContextWrapper(manager, None) # decorate to IZopeContainer
thingy = Undeletable()
manager.setObject('xyzzy', thingy)
manager.beforeDeleteHook(manager, container)
=== Zope3/src/zope/app/services/tests/test_registrations.py 1.2 => 1.2.24.1 ===
--- Zope3/src/zope/app/services/tests/test_registrations.py:1.2 Sun Jun 22 20:31:31 2003
+++ Zope3/src/zope/app/services/tests/test_registrations.py Mon Sep 8 14:21:49 2003
@@ -26,7 +26,6 @@
from zope.app.services.registration import SimpleRegistration
from zope.app.services.registration import ComponentRegistration
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.context import ContextWrapper
from zope.app.interfaces.dependable import IDependable
from zope.app.traversing import traverse
from zope.security.proxy import Proxy
@@ -98,7 +97,7 @@
self.rootFolder.setObject(name, component)
# set up a registration
cfg = ComponentRegistration("/"+name)
- cfg = ContextWrapper(cfg, self.rootFolder)
+ cfg.__parent__ = self.rootFolder
# check that getComponent finds the registration
self.assertEquals(cfg.getComponent(), component)
@@ -109,7 +108,7 @@
# set up a registration
cfg = ComponentRegistration("/"+name, 'zope.TopSecret')
cfg.getInterface = lambda: ITestComponent
- cfg = ContextWrapper(cfg, self.rootFolder)
+ cfg.__parent__ = self.rootFolder
# check that getComponent finds the registration
result = cfg.getComponent()
self.assertEquals(result, component)
=== Zope3/src/zope/app/services/tests/test_registrationstack.py 1.2 => 1.2.18.1 ===
--- Zope3/src/zope/app/services/tests/test_registrationstack.py:1.2 Wed Jul 2 15:43:32 2003
+++ Zope3/src/zope/app/services/tests/test_registrationstack.py Mon Sep 8 14:21:49 2003
@@ -20,7 +20,6 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.app.services.tests.placefulsetup import PlacefulSetup
-from zope.app.context import ContextWrapper, getItem
from zope.app.services.registration import RegistrationStack
from zope.app.traversing import traverse
@@ -41,11 +40,11 @@
PlacefulSetup.setUp(self, site=True)
root = self.rootFolder
self.__default = traverse(root, "++etc++site/default")
- self.__registry = ContextWrapper(RegistrationStack(), root)
+ self.__registry = RegistrationStack(root)
def __config(self, name):
self.__default.setObject(name, Registration())
- return getItem(self.__default, name)
+ return self.__default[name]
def test_register_and_registered_and_nonzero_and_active(self):
registry = self.__registry
=== Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py 1.3 => 1.3.2.1 ===
--- Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py:1.3 Tue Sep 2 16:46:51 2003
+++ Zope3/src/zope/app/services/tests/test_registrationstatusproperty.py Mon Sep 8 14:21:49 2003
@@ -26,11 +26,10 @@
from zope.app.interfaces.services.registration import RegisteredStatus
from zope.app.interfaces.services.registration import UnregisteredStatus
from zope.app.interfaces.services.registration import ActiveStatus
-from zope.app.context import ContextWrapper
from zope.component.exceptions import ComponentLookupError
from zope.app.interfaces.services.registration import NoLocalServiceError
from zope.interface import implements
-
+from zope.app.container.contained import contained
class TestingRegistration(TestingRegistration):
serviceType = "Services"
@@ -89,7 +88,7 @@
def test_property(self):
- configa = ContextWrapper(TestingRegistration('a'), self.rootFolder)
+ configa = contained(TestingRegistration('a'), self.rootFolder)
self.assertEqual(configa.status, UnregisteredStatus)
configa.status = RegisteredStatus
@@ -100,7 +99,7 @@
self.assertEqual(self.__sm.registry._data, ('a', ))
self.assertEqual(configa.status, ActiveStatus)
- configb = ContextWrapper(TestingRegistration('b'), self.rootFolder)
+ configb = contained(TestingRegistration('b'), self.rootFolder)
self.assertEqual(self.__sm.registry._data, ('a', ))
self.assertEqual(configb.status, UnregisteredStatus)
@@ -108,7 +107,7 @@
self.assertEqual(self.__sm.registry._data, ('a', 'b'))
self.assertEqual(configb.status, RegisteredStatus)
- configc = ContextWrapper(TestingRegistration('c'), self.rootFolder)
+ configc = contained(TestingRegistration('c'), self.rootFolder)
self.assertEqual(configc.status, UnregisteredStatus)
self.assertEqual(self.__sm.registry._data, ('a', 'b'))
@@ -134,7 +133,7 @@
# now the ConnectionRegistration.status cannot access the
# SQLConnectionService
- configa = ContextWrapper(PassiveRegistration('a'), self.rootFolder)
+ configa = contained(PassiveRegistration('a'), self.rootFolder)
self.assertEqual(configa.status, UnregisteredStatus)
try:
@@ -155,7 +154,7 @@
# we should also get an error if there *is a matching service,
# not it is non-local
- configa = ContextWrapper(UtilityRegistration('a'), self.rootFolder)
+ configa = contained(UtilityRegistration('a'), self.rootFolder)
self.assertEqual(configa.status, UnregisteredStatus)
try:
=== Zope3/src/zope/app/services/tests/test_servicemanager.py 1.15 => 1.15.2.1 ===
--- Zope3/src/zope/app/services/tests/test_servicemanager.py:1.15 Tue Sep 2 16:46:51 2003
+++ Zope3/src/zope/app/services/tests/test_servicemanager.py Mon Sep 8 14:21:49 2003
@@ -19,7 +19,6 @@
from unittest import TestCase, TestLoader, TextTestRunner
from zope.interface import Interface, implements
-from zope.context import getWrapperContainer
from zope.app.services.service import ServiceManager
from zope.app.services.service import ServiceRegistration
from zope.component import getService, getServiceManager
@@ -57,8 +56,8 @@
traverse(default.getRegistrationManager(), '1').status = ActiveStatus
testOb = getService(self.rootFolder, 'test_service')
- c = getWrapperContainer
- self.assertEqual(c(c(c(testOb))), self.rootFolder)
+ self.assertEqual(testOb.__parent__.__parent__.__parent__,
+ self.rootFolder)
self.assertEqual(testOb, ts)
def test_queryLocalService(self):
@@ -82,8 +81,8 @@
traverse(default.getRegistrationManager(), '1').status = ActiveStatus
testOb = sm.queryLocalService('test_service')
- c = getWrapperContainer
- self.assertEqual(c(c(c(testOb))), self.rootFolder)
+ self.assertEqual(testOb.__parent__.__parent__.__parent__,
+ self.rootFolder)
self.assertEqual(testOb, ts)
@@ -163,29 +162,28 @@
# XXX This test expects that the local module implementation
# (the Manager class) to register itself. This is no longer
# intentional behavior; the right tests need to be determined.
- from zope.app.context import ContextWrapper as cw
from zope.app.services.module import Manager
import zope.app.services.tests.sample1
import zope.app.services.tests.sample2
sm = self.makeSite()
- default = cw(sm['default'], self.rootFolder, name='default')
+ default = contained(sm['default'], self.rootFolder, name='default')
default.setObject('m1', Manager('zope.app.services.tests.sample1',
'x = "root m1"\n'))
- manager = cw(default['m1'], default, name='m1')
+ manager = contained(default['m1'], default, name='m1')
manager.execute()
default.setObject('m2', Manager('XXX.ZZZ',
'x = "root m2"\nZZZ = 42\n'))
- manager = cw(default['m2'], default, name='m2')
+ manager = contained(default['m2'], default, name='m2')
manager.execute()
self.folder1.setSiteManager(ServiceManager())
sm2=getServiceManager(self.folder1)
- default = cw(sm2['default'], self.folder1, name='default')
+ default = contained(sm2['default'], self.folder1, name='default')
default.setObject('m1', Manager('zope.app.services.tests.sample1',
'x = "folder1 m1 1"'))
- manager = cw(default['m1'], default, name='m1')
+ manager = contained(default['m1'], default, name='m1')
manager.execute()
self.assertEqual(
=== Zope3/src/zope/app/services/tests/test_utility.py 1.10 => 1.10.8.1 ===
--- Zope3/src/zope/app/services/tests/test_utility.py:1.10 Wed Aug 6 09:03:21 2003
+++ Zope3/src/zope/app/services/tests/test_utility.py Mon Sep 8 14:21:49 2003
@@ -34,7 +34,6 @@
from zope.app.interfaces.services.utility import ILocalUtility
from zope.app.interfaces.services.registration import IRegistered
from zope.app.interfaces.dependable import IDependable
-from zope.context import getWrapperContainer
from zope.app.tests import setup
class IFo(Interface): pass
@@ -194,8 +193,8 @@
cr2 = utilities.queryRegistrationsFor(
utility.UtilityRegistration("bob", IFoo, path))
self.assertEqual(r, [(IFoo, "", cr1), (IFoo, "bob", cr2)])
- self.assertEqual(getWrapperContainer(r[0][2]), utilities)
- self.assertEqual(getWrapperContainer(r[1][2]), utilities)
+ self.assertEqual(r[0][2].__parent__, utilities)
+ self.assertEqual(r[1][2].__parent__, utilities)
# Now test that an empty registry doesn't show up
for cd in cr1.info(): # Remove everything from cr1
cd['registration'].status = UnregisteredStatus
=== Zope3/src/zope/app/services/tests/test_view.py 1.22 => 1.22.2.1 ===
--- Zope3/src/zope/app/services/tests/test_view.py:1.22 Tue Sep 2 16:46:51 2003
+++ Zope3/src/zope/app/services/tests/test_view.py Mon Sep 8 14:21:49 2003
@@ -22,7 +22,6 @@
from zope.interface.verify import verifyObject
from zope.app.content.folder import RootFolder
-from zope.app.context import ContextWrapper
from zope.app.interfaces.services.view import IZPTTemplate
from zope.app.services.service import ServiceManager
from zope.app.services.servicenames import Views
@@ -44,6 +43,7 @@
from zope.publisher.browser import TestRequest
from zope.publisher.interfaces.browser import IBrowserPresentation
+from zope.app.container.contained import contained
class I1(Interface):
pass
@@ -99,7 +99,7 @@
def createTestingRegistry(self):
- return ContextWrapper(ViewService(), C())
+ return contained(ViewService(), C())
def createTestingRegistration(self):
return Registration()
@@ -213,8 +213,8 @@
def test_getView(self):
folder = ModuleFinder()
- folder = ContextWrapper(folder, folder)
- registration = ContextWrapper(
+ folder = contained(folder, folder)
+ registration = contained(
ViewRegistration(I1, 'test', IBrowserPresentation, "Foo.Bar.A",
'zope.View'),
folder,
@@ -239,11 +239,11 @@
default = traverse(self.rootFolder, '++etc++site/default')
self.__template = PhonyTemplate()
default.setObject('t', self.__template)
- self.folder = ContextWrapper(ModuleFinder(), self.rootFolder)
- self.folder = ContextWrapper(ModuleFinder(), self.folder)
+ self.folder = contained(ModuleFinder(), self.rootFolder)
+ self.folder = contained(ModuleFinder(), self.folder)
def test_getView_template(self):
- registration = ContextWrapper(
+ registration = contained(
PageRegistration(I1, 'test', 'zope.View',
"Foo.Bar.A",
template='/++etc++site/default/t',
@@ -265,7 +265,7 @@
self.assertEqual(registration.presentationType, I2)
def test_getView_attribute(self):
- registration = ContextWrapper(
+ registration = contained(
PageRegistration(I1, 'test', 'zope.View',
"Foo.Bar.A",
attribute='run',
@@ -278,7 +278,7 @@
self.assertEquals(view, A.run)
def test_getView_errors(self):
- registration = ContextWrapper(
+ registration = contained(
PageRegistration(I1, 'test', 'zope.View',
"Foo.Bar.A",
),
More information about the Zope3-Checkins
mailing list