activate the portal as a site in Zope 2.12. This gets translation working...

activate the portal as a site in Zope 2.12. This gets translation working (except for MessageCatalog aliases in our Localizer monkeypatch)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33053 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 360963a3
......@@ -41,6 +41,14 @@ def get_request():
Products.ERP5Type.Utils.get_request = get_request
Globals.get_request = get_request
try:
from zope.site.hooks import setSite
except ImportError:
# BACK: Zope 2.8. setSite is somewhere else, and we can't use it anyway
# since ERP5Site is not yet an ISite. Remove once we drop support for 2.8
def setSite(site=None):
pass
try:
import itools.zope
def get_context():
......@@ -298,6 +306,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
# where it is called exactly once per test.
portal.setupCurrentSkin(portal.REQUEST)
self.REQUEST = portal.REQUEST
setSite(portal)
return portal
getPortalObject = getPortal
......@@ -1014,8 +1023,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
'''Tears down the fixture. Do not override,
use the hooks instead.
'''
# avoid backportUnittest.TestCase.tearDown inheritance and still allow
# "runUnitTest --save" to monkey-patch PortalTestCase.tearDown
setSite() # undo site configuration from self.getPortal()
return PortalTestCase.tearDown(self)
def beforeClose(self):
......
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