Commit 1de396b2 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Only consider .py and .xml files when importing BusinessTemplate files in...

Only consider .py and .xml files when importing BusinessTemplate files in FilesystemToZodbTemplateItem.

This fixes tests failures with ``AttributeError: 'str' object has no attribute
'text_content''' due to .pyc files.
parent 6956d6dc
...@@ -3812,9 +3812,8 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem): ...@@ -3812,9 +3812,8 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
# If portal_components/XXX.py, then ignore it as it will be handled when # If portal_components/XXX.py, then ignore it as it will be handled when
# the .xml file will be processed # the .xml file will be processed
if file_obj.name.rsplit(os.path.sep, 2)[-2] != 'portal_components': if file_obj.name.rsplit(os.path.sep, 2)[-2] != 'portal_components':
return FilesystemDocumentTemplateItem._importFile(self, file_name, FilesystemDocumentTemplateItem._importFile(self, file_name, file_obj)
file_obj) elif file_name.endswith('.xml'):
else:
ObjectTemplateItem._importFile(self, file_name, file_obj) ObjectTemplateItem._importFile(self, file_name, file_obj)
name = file_name[:-4] name = file_name[:-4]
...@@ -3829,6 +3828,8 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem): ...@@ -3829,6 +3828,8 @@ class DocumentTemplateItem(FilesystemToZodbTemplateItem):
# ObjectTemplateItem.__init__() # ObjectTemplateItem.__init__()
self._archive[name] = None self._archive[name] = None
del self._archive[name[len('portal_components/'):]] del self._archive[name[len('portal_components/'):]]
else:
LOG('Business Template', 0, 'Skipping file "%s"' % file_name)
def export(self, context, bta, **kw): def export(self, context, bta, **kw):
path = self.__class__.__name__ + '/' path = self.__class__.__name__ + '/'
......
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