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): ...@@ -333,19 +333,20 @@ class TemplateTool (BaseTool):
prop_path = posixpath.join(tar.members[0].name, 'bt', pid) prop_path = posixpath.join(tar.members[0].name, 'bt', pid)
try: try:
info = tar.getmember(prop_path) info = tar.getmember(prop_path)
value = tar.extractfile(info).read()
except KeyError: except KeyError:
continue value = None
value = tar.extractfile(info).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 continue
if prop_type == 'text' or prop_type == 'string' \ if prop_type in ('text', 'string'):
or prop_type == 'int': prop_dict[pid] = value or ''
prop_dict[pid] = value elif prop_type in ('int', 'boolean'):
elif prop_type == 'lines' or prop_type == 'tokens': prop_dict[pid] = value or 0
prop_dict[pid[:-5]] = value.splitlines() elif prop_type in ('lines', 'tokens'):
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 other files from bt # 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