Commit 635e8ec4 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: no need to search a Software Product if there is no url_string

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