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',
try: name+'/bm/template_format_version',
file = open(os.path.normpath(format_version_path)) ]
format_version = int(file.read())
file.close()
except IOError:
format_version = 1
for path in template_version_path_list:
try:
file = open(os.path.normpath(format_version_path))
except IOError:
pass
format_version = int(file.read())
file.close()
# 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