Commit 17502b24 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Lazy compilations of Python Scripts. This makes installations of Business Templates far faster.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17063 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 16b98de9
...@@ -632,6 +632,7 @@ def setupERP5Site( business_template_list=(), ...@@ -632,6 +632,7 @@ def setupERP5Site( business_template_list=(),
portal.portal_catalog.manage_hotReindexAll() portal.portal_catalog.manage_hotReindexAll()
get_transaction().commit() get_transaction().commit()
portal_activities = getattr(portal, 'portal_activities', None) portal_activities = getattr(portal, 'portal_activities', None)
if portal_activities is not None: if portal_activities is not None:
count = 1000 count = 1000
...@@ -747,4 +748,19 @@ def optimize(): ...@@ -747,4 +748,19 @@ def optimize():
from Products.CMFCore.Expression import Expression from Products.CMFCore.Expression import Expression
Expression.__init__ = __init__ 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() optimize()
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