Commit d23a57af authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix 'Upload Business Template' that did not work when the first entry was not the root directory.

......@@ -316,6 +316,7 @@ class TemplateTool (BaseTool):
# XXX: should really check for a magic and offer a falback if it
# doens't correspond to anything handled.
tar = tarfile.open(path, 'r:gz')
dir_name = tar.members[0].name.split(posixpath.sep, 1)[0]
try:
# create bt object
bt = self.newContent(portal_type='Business Template', id=id)
......@@ -323,7 +324,7 @@ class TemplateTool (BaseTool):
for prop in bt.propertyMap():
prop_type = prop['type']
pid = prop['id']
prop_path = posixpath.join(tar.members[0].name, 'bt', pid)
prop_path = posixpath.join(dir_name, 'bt', pid)
try:
info = tar.getmember(prop_path)
value = tar.extractfile(info).read()
......
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