diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index c21b5d7b8f3b13de7ceb926fe53a0f2454bc586e..aa501bebc83e66f5c076b0ca2755322eca642c74 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -27,7 +27,7 @@ # ############################################################################## -import fnmatch, imp, os, re, shutil, sys +import fnmatch, gc, imp, os, re, shutil, sys from Shared.DC.ZRDB.Connection import Connection as RDBConnection from Products.ERP5Type.DiffUtils import DiffFile from Products.ERP5Type.Globals import Persistent, PersistentMapping @@ -5603,7 +5603,8 @@ Business Template is a set of definitions, such as skins, portal types and categ # Doing a savepoint will pickle them to a temporary storage so that all # references to it can be freed. transaction.savepoint(optimistic=True) - self.getPortalObject()._p_jar.cacheMinimize() + self._p_jar.cacheMinimize() + gc.collect() # Remove temporary modules created above to allow import of real modules # (during the installation). diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py index 7581179b1153607f3ecc455ebca6a1ef81c24ef2..771bb26e2f16fbda9fb6dbdc97777cff50e961f3 100644 --- a/product/ERP5/tests/testBusinessTemplate.py +++ b/product/ERP5/tests/testBusinessTemplate.py @@ -46,6 +46,7 @@ from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.Workflow import addWorkflowByType import shutil import os +import gc from MethodObject import Method from Persistence import Persistent @@ -5959,12 +5960,14 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): bt_path = os.path.join(os.path.dirname(__file__), 'test_data', self._testMethodName) for i in xrange(6): + gc.disable() bt = template_tool.download(bt_path) assert object_id_list.pop() == 'some_file' and not object_id_list if i in (2, 4, 5): transaction.commit() self.tic() bt.install(force=1) + gc.enable() assert not object_id_list transaction.commit() self.tic()