Commit 690e1c4d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

enable yoshinori's hack to increase the performance of installation for

unit tests.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17721 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b669e9aa
......@@ -557,11 +557,9 @@ class ObjectTemplateItem(BaseTemplateItem):
if not os.path.exists(compiled_file) or os.path.getmtime(file.name) > os.path.getmtime(compiled_file):
print 'Compiling %s to %s...' % (file.name, compiled_file)
try:
import Shared.DC.xml.ppml
ppml = Shared.DC.xml.ppml
from Shared.DC.xml import ppml
from OFS.XMLExportImport import start_zopedata, save_record, save_zopedata
import Shared.DC.xml.pyexpat.pyexpat
pyexpat=Shared.DC.xml.pyexpat.pyexpat
import pyexpat
outfile=open(compiled_file, 'wb')
try:
data=file.read()
......@@ -584,9 +582,10 @@ class ObjectTemplateItem(BaseTemplateItem):
raise
return open(compiled_file)
def _importFile(self, file_name, file):
def _importFile(self, file_name, file_obj):
# import xml file
if not file_name.endswith('.xml'):
if not file_name.endswith('.zexp'):
LOG('Business Template', 0, 'Skipping file "%s"' % (file_name, ))
return
obj = self
......@@ -595,8 +594,10 @@ class ObjectTemplateItem(BaseTemplateItem):
obj=obj.aq_parent
connection=obj._p_jar
__traceback_info__ = 'Importing %s' % file_name
obj = connection.importFile(file, customImporters=customImporters)
# obj = connection.importFile(self._compileXML(file))
if isinstance(file_obj, file):
obj = connection.importFile(self._compileXML(file_obj))
else:
obj = connection.importFile(file_obj, customImporters=customImporters)
self._objects[file_name[:-4]] = obj
def preinstall(self, context, installed_bt, **kw):
......
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