Commit 5008eafd authored by Vincent Pelletier's avatar Vincent Pelletier

Check file extension instead of just stripping unknown chars.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20912 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 76fa4bd7
...@@ -2126,17 +2126,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -2126,17 +2126,7 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
ObjectTemplateItem.uninstall(self, context, **kw) ObjectTemplateItem.uninstall(self, context, **kw)
def _importFile(self, file_name, file): def _importFile(self, file_name, file):
if not '.catalog_keys' in file_name: if file_name.endswith('.catalog_keys.xml'):
# just import xml object
obj = self
connection = None
while connection is None:
obj=obj.aq_parent
connection=obj._p_jar
obj = connection.importFile(file, customImporters=customImporters)
self.removeProperties(obj)
self._objects[file_name[:-4]] = obj
else:
# recreate data mapping specific to catalog method # recreate data mapping specific to catalog method
name = os.path.basename(file_name) name = os.path.basename(file_name)
id = name.split('.', 1)[0] id = name.split('.', 1)[0]
...@@ -2168,6 +2158,18 @@ class CatalogMethodTemplateItem(ObjectTemplateItem): ...@@ -2168,6 +2158,18 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
else: else:
# new style key # new style key
self._method_properties.setdefault(id, PersistentMapping())[key] = 1 self._method_properties.setdefault(id, PersistentMapping())[key] = 1
elif file_name.endswith('.xml'):
# just import xml object
obj = self
connection = None
while connection is None:
obj=obj.aq_parent
connection=obj._p_jar
obj = connection.importFile(file, customImporters=customImporters)
self.removeProperties(obj)
self._objects[file_name[:-4]] = obj
else:
LOG('Business Template', 0, 'Skipping file "%s"' % (file_name, ))
class ActionTemplateItem(ObjectTemplateItem): class ActionTemplateItem(ObjectTemplateItem):
......
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