From 5ce139bab2fdc71cf0f78b99a71eac4fc920398d Mon Sep 17 00:00:00 2001
From: Leonardo Rochael Almeida <leonardo@nexedi.com>
Date: Fri, 29 Jan 2010 15:50:20 +0000
Subject: [PATCH] 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
---
 product/ERP5Form/tests/testFields.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Form/tests/testFields.py b/product/ERP5Form/tests/testFields.py
index cdf75a2ea2..b2e9897cb3 100644
--- a/product/ERP5Form/tests/testFields.py
+++ b/product/ERP5Form/tests/testFields.py
@@ -31,6 +31,12 @@
 
 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
 class DummyRequest(dict):
   __allow_access_to_unprotected_subobjects__ = 1
@@ -304,12 +310,13 @@ class TestTextAreaField(unittest.TestCase):
       .xpath('%s/text:tab' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)
     self.assertTrue(test_value)
 
-class TestProxyField(unittest.TestCase):
+class TestProxyField(PlacelessSetup, unittest.TestCase):
 
   def getTitle(self):
     return "Proxy Field"
 
   def setUp(self):
+    super(TestProxyField, self).setUp()
     self.container = Folder('container').__of__(Folder('root'))
     self.container._setObject('Base_viewProxyFieldLibrary',
                                ERP5Form('Base_viewProxyFieldLibrary', 'Proxys'))
@@ -318,6 +325,13 @@ class TestProxyField(unittest.TestCase):
     global request
     request = DummyRequest()
     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):
     form.manage_addField(id, title, field_type)
-- 
2.30.9