from DateTime import DateTime

project = context
portal = context.getPortalObject()

destination_value = portal.portal_membership.getAuthenticatedMember().getUserValue()

allocation_predicate_list = project.Project_getSoftwareProductPredicateList(destination_value=destination_value)

result_list = []

for allocation_predicate in allocation_predicate_list:

  software_product = allocation_predicate.getResourceValue()

  try:
    subscription_request = software_product.Resource_createSubscriptionRequest(
      destination_value,
      # [software_type, software_release],
      allocation_predicate.getVariationCategoryList(),
      context,
      temp_object=True
    )
  except AssertionError:
    continue

  price = subscription_request.getPrice(None)
  if price is not None:
    result_list.append(allocation_predicate.asContext(
      title = '%s (%s %s/%s)' % (software_product.getTitle(), price, subscription_request.getPriceCurrencyTitle(), subscription_request.getQuantityUnitTitle()) if (price != 0) else software_product.getTitle()
    ))

return result_list
