Commit eefe3731 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

no longer export empty files under bt/ directory.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39108 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2864b46b
...@@ -4832,7 +4832,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -4832,7 +4832,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
'install_object_list_list', 'id_generator', 'bt_for_diff'): 'install_object_list_list', 'id_generator', 'bt_for_diff'):
continue continue
value = self.getProperty(id) value = self.getProperty(id)
if value is None: if not value:
continue continue
if prop_type in ('text', 'string', 'int', 'boolean'): if prop_type in ('text', 'string', 'int', 'boolean'):
bta.addObject(obj=value, name=id, path=path+os.sep+'bt', ext='') bta.addObject(obj=value, name=id, path=path+os.sep+'bt', ext='')
......
...@@ -402,17 +402,20 @@ class TemplateTool (BaseTool): ...@@ -402,17 +402,20 @@ class TemplateTool (BaseTool):
pid = prop['id'] pid = prop['id']
prop_path = os.path.join('.', bt_path, pid) prop_path = os.path.join('.', bt_path, pid)
if not os.path.exists(prop_path): if not os.path.exists(prop_path):
continue value = None
value = open(prop_path, 'rb').read() else:
value = open(prop_path, 'rb').read()
if value is 'None': if value is 'None':
# At export time, we used to export non-existent properties: # At export time, we used to export non-existent properties:
# str(obj.getProperty('non-existing')) == 'None' # str(obj.getProperty('non-existing')) == 'None'
# Discard them # Discard them
continue value = None
if prop_type in ('text', 'string'):
prop_dict[pid] = value or ''
if prop_type in ('text', 'string', 'int', 'boolean'): if prop_type in ('text', 'string', 'int', 'boolean'):
prop_dict[pid] = value prop_dict[pid] = value or 0
elif prop_type in ('lines', 'tokens'): elif prop_type in ('lines', 'tokens'):
prop_dict[pid[:-5]] = value.splitlines() prop_dict[pid[:-5]] = (value or '').splitlines()
prop_dict.pop('id', '') prop_dict.pop('id', '')
bt.edit(**prop_dict) bt.edit(**prop_dict)
# import all others objects # import all others objects
......
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