Commit 6bc77078 authored by Jérome Perrin's avatar Jérome Perrin

BusinessTemplate: do not export PythonScripts' Script_magic

This is used to trigger recompilation of bytecode, but we don't
export the byte code so we don't need to export it.
This also prevent diffs when the Script_magic changed, like it's the
case with Products.PythonScripts 4.2 , with commit 590125a (Force
recompilation of scripts., 2017-10-23).
parent 0fbc3f6c
...@@ -594,13 +594,21 @@ class BaseTemplateItem(Implicit, Persistent): ...@@ -594,13 +594,21 @@ class BaseTemplateItem(Implicit, Persistent):
# PythonScript covers both Zope Python scripts # PythonScript covers both Zope Python scripts
# and ERP5 Python Scripts # and ERP5 Python Scripts
if isinstance(obj, PythonScript): if isinstance(obj, PythonScript):
# `expression_instance` is included so as to add compatibility for attr_set.update(
# exporting older catalog methods which might have them as their (
# properties or in their attribute dict. '__code__',
attr_set.update(('func_code', '__code__', 'func_code',
'func_defaults', '__defaults__', '__defaults__',
'_code', '_lazy_compilation', 'Python_magic', 'func_defaults',
'expression_instance')) '_code',
'_lazy_compilation',
'Python_magic',
'Script_magic',
# `expression_instance` is included so as to add compatibility for
# exporting older catalog methods which might have them as their
# properties or in their attribute dict.
'expression_instance',
))
for attr in 'errors', 'warnings', '_proxy_roles': for attr in 'errors', 'warnings', '_proxy_roles':
if not obj.__dict__.get(attr, 1): if not obj.__dict__.get(attr, 1):
delattr(obj, attr) delattr(obj, attr)
...@@ -863,7 +871,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -863,7 +871,7 @@ class ObjectTemplateItem(BaseTemplateItem):
f = BytesIO() f = BytesIO()
exportXML(obj._p_jar, obj._p_oid, f) exportXML(obj._p_jar, obj._p_oid, f)
bta.addObject(f, key, path=path) bta.addObject(f, key, path=path)
if catalog_method_template_item: if catalog_method_template_item:
# add all datas specific to catalog inside one file # add all datas specific to catalog inside one file
xml_data = self.generateXml(key) xml_data = self.generateXml(key)
...@@ -931,7 +939,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -931,7 +939,7 @@ class ObjectTemplateItem(BaseTemplateItem):
# already exist, therefore BaseTemplateItem.__init__() is called which # already exist, therefore BaseTemplateItem.__init__() is called which
# does not set _archive with portal_components/ like # does not set _archive with portal_components/ like
# ObjectTemplateItem.__init__() # ObjectTemplateItem.__init__()
# XXX - the above comment is a bit unclear, # XXX - the above comment is a bit unclear,
# still not sure if this is handled correctly # still not sure if this is handled correctly
if file_obj.name.rsplit(os.path.sep, 2)[-2] == 'portal_components': if file_obj.name.rsplit(os.path.sep, 2)[-2] == 'portal_components':
self._archive[obj_key] = None self._archive[obj_key] = None
...@@ -4357,14 +4365,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem, ...@@ -4357,14 +4365,14 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem,
action for developers action for developers
""" """
return path.startswith(self._tool_id + '/') return path.startswith(self._tool_id + '/')
# XXX temporary should be eliminated from here # XXX temporary should be eliminated from here
def _importFile(self, file_name, file_obj): def _importFile(self, file_name, file_obj):
ObjectTemplateItem._importFile(self, file_name, file_obj) ObjectTemplateItem._importFile(self, file_name, file_obj)
# XXX temporary should be eliminated from here # XXX temporary should be eliminated from here
def export(self, context, bta, **kw): def export(self, context, bta, **kw):
ObjectTemplateItem.export(self, context, bta, **kw) ObjectTemplateItem.export(self, context, bta, **kw)
def getTemplateIdList(self): def getTemplateIdList(self):
""" """
......
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