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(): ...@@ -41,6 +41,14 @@ def get_request():
Products.ERP5Type.Utils.get_request = get_request Products.ERP5Type.Utils.get_request = get_request
Globals.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: try:
import itools.zope import itools.zope
def get_context(): def get_context():
...@@ -298,6 +306,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): ...@@ -298,6 +306,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
# where it is called exactly once per test. # where it is called exactly once per test.
portal.setupCurrentSkin(portal.REQUEST) portal.setupCurrentSkin(portal.REQUEST)
self.REQUEST = portal.REQUEST self.REQUEST = portal.REQUEST
setSite(portal)
return portal return portal
getPortalObject = getPortal getPortalObject = getPortal
...@@ -1014,8 +1023,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): ...@@ -1014,8 +1023,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
'''Tears down the fixture. Do not override, '''Tears down the fixture. Do not override,
use the hooks instead. use the hooks instead.
''' '''
# avoid backportUnittest.TestCase.tearDown inheritance and still allow setSite() # undo site configuration from self.getPortal()
# "runUnitTest --save" to monkey-patch PortalTestCase.tearDown
return PortalTestCase.tearDown(self) return PortalTestCase.tearDown(self)
def beforeClose(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