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

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Oct 20 23:10:36 CEST 2007


Author: yo
Date: Sat Oct 20 23:10:36 2007
New Revision: 17063

URL: http://svn.erp5.org?rev=17063&view=rev
Log:
Lazy compilations of Python Scripts. This makes installations of Business Templates far faster.

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=17063&r1=17062&r2=17063&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py Sat Oct 20 23:10:36 2007
@@ -632,6 +632,7 @@
             portal.portal_catalog.manage_hotReindexAll()
 
           get_transaction().commit()
+
           portal_activities = getattr(portal, 'portal_activities', None)
           if portal_activities is not None:
             count = 1000
@@ -747,4 +748,19 @@
   from Products.CMFCore.Expression import Expression
   Expression.__init__ = __init__
 
+  # Delay the compilations of Python Scripts until they are really executed.
+  from Products.PythonScripts.PythonScript import PythonScript
+  PythonScript_compile = PythonScript._compile
+  def _compile(self):
+    self._lazy_compilation = 1
+  PythonScript._compile = _compile
+  PythonScript_exec = PythonScript._exec
+  def _exec(self, *args):
+    if getattr(self, '_lazy_compilation', 0):
+      self._lazy_compilation = 0
+      PythonScript_compile(self)
+    return PythonScript_exec(self, *args)
+  PythonScript._exec = _exec
+
+
 optimize()




More information about the Erp5-report mailing list