Commit 92413d8c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

treat boolean property correctly in _importBT() and also set an appropriate...

treat boolean property correctly in _importBT() and also set an appropriate value for empty values (cf. r39108 and r39104).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43227 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 425c66a5
......@@ -333,19 +333,20 @@ class TemplateTool (BaseTool):
prop_path = posixpath.join(tar.members[0].name, 'bt', pid)
try:
info = tar.getmember(prop_path)
value = tar.extractfile(info).read()
except KeyError:
continue
value = tar.extractfile(info).read()
value = None
if value is 'None':
# At export time, we used to export non-existent properties:
# str(obj.getProperty('non-existing')) == 'None'
# Discard them
continue
if prop_type == 'text' or prop_type == 'string' \
or prop_type == 'int':
prop_dict[pid] = value
elif prop_type == 'lines' or prop_type == 'tokens':
prop_dict[pid[:-5]] = value.splitlines()
if prop_type in ('text', 'string'):
prop_dict[pid] = value or ''
elif prop_type in ('int', 'boolean'):
prop_dict[pid] = value or 0
elif prop_type in ('lines', 'tokens'):
prop_dict[pid[:-5]] = (value or '').splitlines()
prop_dict.pop('id', '')
bt.edit(**prop_dict)
# import all other files from bt
......
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