[Erp5-report] r32811 jm - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 19 02:46:19 CET 2010


Author: jm
Date: Fri Feb 19 02:46:18 2010
New Revision: 32811

URL: http://svn.erp5.org?rev=32811&view=rev
Log:
Also do garbage collection to remove references from non-persistent objects

_objects member BaseTemplateItem class is a PersistentMapping object, which
contains a _dict_ of persistent objects. In some cases, this dict remained in
memory, preventing pickle cache to remove objects with temporary classes.

Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py
    erp5/trunk/products/ERP5/tests/testBusinessTemplate.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=32811&r1=32810&r2=32811&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Fri Feb 19 02:46:18 2010
@@ -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 @@
         # 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).

Modified: erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBusinessTemplate.py?rev=32811&r1=32810&r2=32811&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Fri Feb 19 02:46:18 2010
@@ -46,6 +46,7 @@
 from Products.ERP5Type.Workflow import addWorkflowByType
 import shutil
 import os
+import gc
 
 from MethodObject import Method
 from Persistence import Persistent
@@ -5959,12 +5960,14 @@
       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()




More information about the Erp5-report mailing list