Commit 4c805aea authored by Aurel's avatar Aurel

call edit to make transitions in the right order

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4285 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da9048db
No related merge requests found
......@@ -187,6 +187,7 @@ class TemplateTool (BaseTool):
# create bt object
self.newContent(portal_type='Business Template', id=id)
bt = self._getOb(id)
prop_dict = {}
for prop in bt.propertyMap():
type = prop['type']
pid = prop['id']
......@@ -196,10 +197,10 @@ class TemplateTool (BaseTool):
info = tar.getmember(prop_path)
value = tar.extractfile(info).read()
if type == 'text' or type == 'string' or type == 'int':
bt.setProperty(pid, value, type)
prop_dict[pid] = value
elif type == 'lines' or type == 'tokens':
bt.setProperty(pid[:-5], value.split('\n'), type)
prop_dict[pid[:-5]] = value.split(str(os.linesep))
bt.edit(**prop_dict)
# import all other files from bt
fobj = open(path, 'r')
bt.importFile(file=fobj)
......@@ -231,6 +232,7 @@ class TemplateTool (BaseTool):
bt_path = os.path.join(name, 'bt')
# import properties
prop_dict = {}
for prop in bt.propertyMap():
type = prop['type']
pid = prop['id']
......@@ -239,10 +241,10 @@ class TemplateTool (BaseTool):
prop_path = os.path.join(bt_path, pid)
value = open(prop_path, 'r').read()
if type in ('text', 'string', 'int'):
bt.setProperty(pid, value, type)
prop_dict[pid] = value
elif type in ('lines', 'tokens'):
bt.setProperty(pid[:-5], value.split(str(os.linesep)), type)
prop_dict[pid[:-5]] = value.split(str(os.linesep))
bt.edit(**prop_dict)
# import all others objects
bt.importFile(dir=1, file=file_list, root_path=name)
else:
......
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