setup default traversable adapter to fix failure on Zope 2.12

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32094 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cbe1dc42
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
import unittest import unittest
try:
from zope.app.testing.placelesssetup import PlacelessSetup
except ImportError:
# BACK: Zope 2.8. Remove when we no longer support it
from zope.component.tests.placelesssetup import PlacelessSetup
# Make it possible to use Globals.get_request # Make it possible to use Globals.get_request
class DummyRequest(dict): class DummyRequest(dict):
__allow_access_to_unprotected_subobjects__ = 1 __allow_access_to_unprotected_subobjects__ = 1
...@@ -304,12 +310,13 @@ class TestTextAreaField(unittest.TestCase): ...@@ -304,12 +310,13 @@ class TestTextAreaField(unittest.TestCase):
.xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP) .xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)
self.assertTrue(test_value) self.assertTrue(test_value)
class TestProxyField(unittest.TestCase): class TestProxyField(PlacelessSetup, unittest.TestCase):
def getTitle(self): def getTitle(self):
return "Proxy Field" return "Proxy Field"
def setUp(self): def setUp(self):
super(TestProxyField, self).setUp()
self.container = Folder('container').__of__(Folder('root')) self.container = Folder('container').__of__(Folder('root'))
self.container._setObject('Base_viewProxyFieldLibrary', self.container._setObject('Base_viewProxyFieldLibrary',
ERP5Form('Base_viewProxyFieldLibrary', 'Proxys')) ERP5Form('Base_viewProxyFieldLibrary', 'Proxys'))
...@@ -318,6 +325,13 @@ class TestProxyField(unittest.TestCase): ...@@ -318,6 +325,13 @@ class TestProxyField(unittest.TestCase):
global request global request
request = DummyRequest() request = DummyRequest()
self.container.REQUEST = request self.container.REQUEST = request
try:
from Products.CMFCore.tests.base.utils import _setUpDefaultTraversable
_setUpDefaultTraversable()
except ImportError:
pass # On Zope 2.8, remove when we no longer support it
# if tearDown is ever added, don't forget to call PlacelessSetup.tearDown()
def addField(self, form, id, title, field_type): def addField(self, form, id, title, field_type):
form.manage_addField(id, title, field_type) form.manage_addField(id, title, field_type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment