Commit abecde7f authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: search for template_format_version for Business Manager

parent dcca0bdf
...@@ -336,6 +336,10 @@ class TemplateTool (BaseTool): ...@@ -336,6 +336,10 @@ class TemplateTool (BaseTool):
bp = self.newContent(bt_id, 'Business Package') bp = self.newContent(bt_id, 'Business Package')
bp.importFile(path) bp.importFile(path)
return bp return bp
elif format_version == 3:
bm = self.newContent(bt_id, 'Business Manager')
bm.importFile(path)
return bm
bt = self.newContent(bt_id, 'Business Template') bt = self.newContent(bt_id, 'Business Template')
bt.importFile(path) bt.importFile(path)
...@@ -390,15 +394,18 @@ class TemplateTool (BaseTool): ...@@ -390,15 +394,18 @@ class TemplateTool (BaseTool):
return self[self._setObject(id, bt)] return self[self._setObject(id, bt)]
bt = self._download_url(url, id) bt = self._download_url(url, id)
else: else:
# Check the format version for the bt template_version_path_list = [
format_version_path = name+'/bp/template_format_version' name+'/bp/template_format_version',
name+'/bm/template_format_version',
]
for path in template_version_path_list:
try: try:
file = open(os.path.normpath(format_version_path)) file = open(os.path.normpath(format_version_path))
except IOError:
pass
format_version = int(file.read()) format_version = int(file.read())
file.close() file.close()
except IOError:
format_version = 1
# XXX: Download only needed in case the file is in directory # XXX: Download only needed in case the file is in directory
bt = self._download_local(os.path.normpath(name), id, format_version) bt = self._download_local(os.path.normpath(name), id, format_version)
......
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