[Erp5-report] r33053 leonardo - /erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 23 17:59:39 CET 2010


Author: leonardo
Date: Tue Feb 23 17:59:35 2010
New Revision: 33053

URL: http://svn.erp5.org?rev=33053&view=rev
Log:
activate the portal as a site in Zope 2.12. This gets translation working (except for MessageCatalog aliases in our Localizer monkeypatch)

Modified:
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=33053&r1=33052&r2=33053&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Tue Feb 23 17:59:35 2010
@@ -40,6 +40,14 @@
 
 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
@@ -298,6 +306,7 @@
       # 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 @@
       '''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):




More information about the Erp5-report mailing list