Commit 9df847b4 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: return nothing is no Software Product is found

parent 4db1fa64
...@@ -4,30 +4,32 @@ software_product = None ...@@ -4,30 +4,32 @@ software_product = None
software_release = None software_release = None
software_type = None software_type = None
use_category_uid = portal.restrictedTraverse("portal_categories/use/trade/sale").getUid(),
product_list = portal.portal_catalog( product_list = portal.portal_catalog(
portal_type="Software Product", portal_type="Software Product",
validation_state=['validated', 'published'], validation_state=['validated', 'published'],
use__relative_url="trade/sale", use__uid=use_category_uid,
follow_up__uid=context.getFollowUpUid() follow_up__uid=context.getFollowUpUid()
) )
software_release = portal.portal_catalog.getResultValue( if len(product_list) != 0:
portal_type="Software Product Release Variation", software_release = portal.portal_catalog.getResultValue(
url_string=url_string, portal_type="Software Product Release Variation",
parent_uid=[x.getUid() for x in product_list] url_string=url_string,
) parent_uid=[x.getUid() for x in product_list]
)
if software_release is not None: if software_release is not None:
software_product = software_release.getParentValue() software_product = software_release.getParentValue()
software_type = portal.portal_catalog.getResultValue( software_type = portal.portal_catalog.getResultValue(
parent_uid=software_product.getUid(), parent_uid=software_product.getUid(),
title=context.getSourceReference(), title=context.getSourceReference(),
portal_type="Software Product Type Variation" portal_type="Software Product Type Variation"
) )
if software_type is None: if software_type is None:
software_release = None software_release = None
software_product = None software_product = None
return software_product, software_release, software_type return software_product, software_release, software_type
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