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
...@@ -76,7 +76,7 @@ from urllib import quote, unquote ...@@ -76,7 +76,7 @@ from urllib import quote, unquote
from difflib import unified_diff from difflib import unified_diff
import posixpath import posixpath
import shutil import shutil
# those attributes from CatalogMethodTemplateItem are kept for # those attributes from CatalogMethodTemplateItem are kept for
# backward compatibility # backward compatibility
catalog_method_list = ('_is_catalog_list_method_archive', catalog_method_list = ('_is_catalog_list_method_archive',
...@@ -435,7 +435,7 @@ class BaseTemplateItem(Implicit, Persistent): ...@@ -435,7 +435,7 @@ class BaseTemplateItem(Implicit, Persistent):
""" """
_marker = [] _marker = []
base_obj = aq_base(obj) base_obj = aq_base(obj)
if getattr(base_obj, '_dav_writelocks', _marker) is not _marker: if getattr(base_obj, '_dav_writelocks', _marker) is not _marker:
del aq_base(obj)._dav_writelocks del aq_base(obj)._dav_writelocks
if getattr(base_obj, '__ac_local_roles__', _marker) is not _marker: if getattr(base_obj, '__ac_local_roles__', _marker) is not _marker:
...@@ -557,11 +557,9 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -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): 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) print 'Compiling %s to %s...' % (file.name, compiled_file)
try: try:
import Shared.DC.xml.ppml from Shared.DC.xml import ppml
ppml = Shared.DC.xml.ppml
from OFS.XMLExportImport import start_zopedata, save_record, save_zopedata from OFS.XMLExportImport import start_zopedata, save_record, save_zopedata
import Shared.DC.xml.pyexpat.pyexpat import pyexpat
pyexpat=Shared.DC.xml.pyexpat.pyexpat
outfile=open(compiled_file, 'wb') outfile=open(compiled_file, 'wb')
try: try:
data=file.read() data=file.read()
...@@ -584,10 +582,11 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -584,10 +582,11 @@ class ObjectTemplateItem(BaseTemplateItem):
raise raise
return open(compiled_file) return open(compiled_file)
def _importFile(self, file_name, file): def _importFile(self, file_name, file_obj):
# import xml file # import xml file
if not file_name.endswith('.xml'): if not file_name.endswith('.xml'):
LOG('Business Template', 0, 'Skipping file "%s"' % (file_name, )) if not file_name.endswith('.zexp'):
LOG('Business Template', 0, 'Skipping file "%s"' % (file_name, ))
return return
obj = self obj = self
connection = None connection = None
...@@ -595,8 +594,10 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -595,8 +594,10 @@ class ObjectTemplateItem(BaseTemplateItem):
obj=obj.aq_parent obj=obj.aq_parent
connection=obj._p_jar connection=obj._p_jar
__traceback_info__ = 'Importing %s' % file_name __traceback_info__ = 'Importing %s' % file_name
obj = connection.importFile(file, customImporters=customImporters) if isinstance(file_obj, file):
# obj = connection.importFile(self._compileXML(file)) obj = connection.importFile(self._compileXML(file_obj))
else:
obj = connection.importFile(file_obj, customImporters=customImporters)
self._objects[file_name[:-4]] = obj self._objects[file_name[:-4]] = obj
def preinstall(self, context, installed_bt, **kw): 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