[Erp5-report] r39108 kazuhiko - in /erp5/trunk/products/ERP5: Document/ Tool/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 13 17:22:11 CEST 2010


Author: kazuhiko
Date: Wed Oct 13 17:22:10 2010
New Revision: 39108

URL: http://svn.erp5.org?rev=39108&view=rev
Log:
no longer export empty files under bt/ directory.

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

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=39108&r1=39107&r2=39108&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Wed Oct 13 17:22:10 2010
@@ -4832,7 +4832,7 @@ Business Template is a set of definition
                   'install_object_list_list', 'id_generator', 'bt_for_diff'):
           continue
         value = self.getProperty(id)
-        if value is None:
+        if not value:
           continue
         if prop_type in ('text', 'string', 'int', 'boolean'):
           bta.addObject(obj=value, name=id, path=path+os.sep+'bt', ext='')

Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=39108&r1=39107&r2=39108&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] Wed Oct 13 17:22:10 2010
@@ -402,17 +402,20 @@ class TemplateTool (BaseTool):
           pid = prop['id']
           prop_path = os.path.join('.', bt_path, pid)
           if not os.path.exists(prop_path):
-            continue
-          value = open(prop_path, 'rb').read()
+            value = None
+          else:
+            value = open(prop_path, 'rb').read()
           if value is 'None':
             # At export time, we used to export non-existent properties:
             #   str(obj.getProperty('non-existing')) == 'None'
             # Discard them
-            continue
+            value = None
+          if prop_type in ('text', 'string'):
+            prop_dict[pid] = value or ''
           if prop_type in ('text', 'string', 'int', 'boolean'):
-            prop_dict[pid] = value
+            prop_dict[pid] = value or 0
           elif prop_type in ('lines', 'tokens'):
-            prop_dict[pid[:-5]] = value.splitlines()
+            prop_dict[pid[:-5]] = (value or '').splitlines()
         prop_dict.pop('id', '')
         bt.edit(**prop_dict)
         # import all others objects




More information about the Erp5-report mailing list