Commit fa5741d3 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Improve scripts to get list and newest Sofware Release

parent 3a2a3e5c
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
software_instance = hosting_subscription.getPredecessorValue()\n software_instance = hosting_subscription.getPredecessorValue()\n
if not software_instance:\n
return ""\n
software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n software_release_list = context.SoftwareProduct_getSortedSoftwareReleaseList(\n
software_release_url=software_instance.getUrlString())\n software_release_url=software_instance.getUrlString())\n
\n \n
......
...@@ -56,10 +56,14 @@ portal = context.getPortalObject()\n ...@@ -56,10 +56,14 @@ portal = context.getPortalObject()\n
\n \n
if software_product_reference is None:\n if software_product_reference is None:\n
assert(software_release_url is not None)\n assert(software_release_url is not None)\n
try:\n
software_product_reference = portal.portal_catalog.getResultValue(\n software_product_reference = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n portal_type=\'Software Release\',\n
url_string=software_release_url\n url_string=software_release_url\n
).getAggregateValue().getReference()\n ).getAggregateValue().getReference()\n
except:\n
# Could not find Software Release or Software Product\n
return []\n
else:\n else:\n
# Don\'t accept both parameters\n # Don\'t accept both parameters\n
assert(software_release_url is None)\n assert(software_release_url is None)\n
...@@ -74,9 +78,8 @@ if not product_list:\n ...@@ -74,9 +78,8 @@ if not product_list:\n
if len(product_list) > 1:\n if len(product_list) > 1:\n
raise NotImplementedError(\'Several Software Product with the same title.\')\n raise NotImplementedError(\'Several Software Product with the same title.\')\n
\n \n
software_release_list = product_list[0].getAggregateRelatedValueList()\n
software_release_list = sorted(\n software_release_list = sorted(\n
software_release_list,\n product_list[0].getAggregateRelatedValueList(),\n
key=lambda software_release: software_release.getCreationDate(),\n key=lambda software_release: software_release.getCreationDate(),\n
reverse=True,\n reverse=True,\n
)\n )\n
......
314 315
\ 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