Commit 15dc0f7a authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Sebastien Robin

Use Active Process on promise check to report failure on bt5 dependency resolution

Instead raise an exception, try..except to log incapability of resolve the algorithm
parent 1cc72a85
...@@ -51,8 +51,10 @@ ...@@ -51,8 +51,10 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n <value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n
from Products.ERP5.Tool.TemplateTool import BusinessTemplateUnknownError\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
template_tool = portal.portal_templates\n
bt5 = portal.getPromiseParameter(\'portal_templates\', \'expected_bt5\')\n bt5 = portal.getPromiseParameter(\'portal_templates\', \'expected_bt5\')\n
\n \n
if bt5 is None:\n if bt5 is None:\n
...@@ -60,26 +62,35 @@ if bt5 is None:\n ...@@ -60,26 +62,35 @@ if bt5 is None:\n
\n \n
active_result = ActiveResult()\n active_result = ActiveResult()\n
\n \n
portal.portal_templates.updateRepositoryBusinessTemplateList(portal.portal_templates.getRepositoryList())\n template_tool.updateRepositoryBusinessTemplateList(\n
template_tool.getRepositoryList())\n
\n \n
bt5_list = [x[1] for x in portal.portal_templates.resolveBusinessTemplateListDependency(bt5.split(), newest_only=True)]\n try:\n
bt5_list.extend([x.getTitle() for x in portal.portal_templates.getUpdatedRepositoryBusinessTemplateList()])\n bt5_list = [x[1] for x in template_tool.resolveBusinessTemplateListDependency(\n
bt5_list = list(set(bt5_list))\n bt5.split(),\n
newest_only=True)]\n
\n \n
# XXX Can not import BusinessTemplateUnknownError\n bt5_list.extend([x.getTitle() for x in \\\n
# except BusinessTemplateUnknownError, error:\n template_tool.getUpdatedRepositoryBusinessTemplateList()])\n
# active_result.edit(\n
# summary="Unable to resolve bt5 dependencies", \n
# severity=5, \n
# detail=error)\n
\n \n
severity = len(bt5_list)\n bt5_list = list(set(bt5_list))\n
if severity == 0:\n severity = len(bt5_list)\n
\n
except BusinessTemplateUnknownError, error:\n
severity = -1\n
detail = str(error)\n
\n
if severity == -1:\n
severity = 5\n
summary = "Unable to resolve bt5 dependencies"\n
\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 = "Needed to install %s" % \', \'.join(bt5_list)\n
\n
active_result.edit(\n active_result.edit(\n
summary=summary, \n summary=summary, \n
severity=severity,\n severity=severity,\n
......
12 13
\ 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