Commit e9511377 authored by Rafael Monnerat's avatar Rafael Monnerat

use upgradeSite API to install Business Templates

parent e8e449fc
...@@ -62,20 +62,12 @@ if bt5 is None:\n ...@@ -62,20 +62,12 @@ if bt5 is None:\n
\n \n
active_result = ActiveResult()\n active_result = ActiveResult()\n
\n \n
template_tool.updateRepositoryBusinessTemplateList(\n bt5_list = bt5.split()\n
template_tool.getRepositoryList())\n bt5_list.extend(template_tool.getInstalledBusinessTemplateTitleList())\n
\n \n
try:\n try:\n
bt5_list = [x[1] for x in template_tool.resolveBusinessTemplateListDependency(\n message_list = template_tool.upgradeSite(bt5_list, dry_run=True)\n
bt5.split(),\n severity = len(message_list)\n
newest_only=True)]\n
\n
bt5_list.extend([x.getTitle() for x in \\\n
template_tool.getUpdatedRepositoryBusinessTemplateList()])\n
\n
bt5_list = list(set(bt5_list))\n
severity = len(bt5_list)\n
\n
except BusinessTemplateUnknownError, error:\n except BusinessTemplateUnknownError, error:\n
severity = -1\n severity = -1\n
detail = str(error)\n detail = str(error)\n
...@@ -83,13 +75,13 @@ except BusinessTemplateUnknownError, error:\n ...@@ -83,13 +75,13 @@ except BusinessTemplateUnknownError, error:\n
if severity == -1:\n if severity == -1:\n
severity = 5\n severity = 5\n
summary = "Unable to resolve bt5 dependencies"\n summary = "Unable to resolve bt5 dependencies"\n
\n
elif severity == 0:\n elif severity == 0:\n
summary = "Nothing to do."\n summary = "Nothing to do."\n
detail = ""\n detail = ""\n
else:\n else:\n
summary = "Upgrade needed"\n summary = "Upgrade needed."\n
detail = "Needed to install %s" % \', \'.join(bt5_list)\n detail = "Information: %s" % ",".join(message_list)\n
\n
\n \n
active_result.edit(\n active_result.edit(\n
summary=summary, \n summary=summary, \n
......
...@@ -56,12 +56,9 @@ bt5 = portal.getPromiseParameter(\'portal_templates\', \'expected_bt5\')\n ...@@ -56,12 +56,9 @@ bt5 = portal.getPromiseParameter(\'portal_templates\', \'expected_bt5\')\n
if bt5 is None:\n if bt5 is None:\n
return\n return\n
\n \n
bt5_list = [x[1] for x in portal.portal_templates.resolveBusinessTemplateListDependency(bt5.split(), newest_only=True)]\n bt5_list = bt5.split()\n
bt5_list.extend([x.getTitle() for x in portal.portal_templates.getUpdatedRepositoryBusinessTemplateList()])\n bt5_list.extend(portal.portal_templates.getInstalledBusinessTemplateTitleList())\n
bt5_list = list(set(bt5_list))\n portal.portal_templates.upgradeSite(bt5_list)\n
\n
portal.portal_templates.installBusinessTemplateListFromRepository(\n
bt5_list, activate=True, install_dependency=True)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
18 19
\ No newline at end of file \ No newline at end of file
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