[Erp5-report] r20912 - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 12 04:07:04 CEST 2008


Author: vincent
Date: Mon May 12 04:07:04 2008
New Revision: 20912

URL: http://svn.erp5.org?rev=20912&view=rev
Log:
Check file extension instead of just stripping unknown chars.

Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=20912&r1=20911&r2=20912&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py Mon May 12 04:07:04 2008
@@ -2126,17 +2126,7 @@
     ObjectTemplateItem.uninstall(self, context, **kw)
 
   def _importFile(self, file_name, file):
-    if not '.catalog_keys' in file_name:
-      # 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:
+    if file_name.endswith('.catalog_keys.xml'):
       # recreate data mapping specific to catalog method
       name = os.path.basename(file_name)
       id = name.split('.', 1)[0]
@@ -2168,6 +2158,18 @@
         else:
           # new style key
           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):
 




More information about the Erp5-report mailing list