Commit d8649c08 authored by Romain Courteaud's avatar Romain Courteaud Committed by Łukasz Nowak

Use portal_catalog in order to have security during selection.

By using portal_catalog it is assured that only available to current
user objects will be returned.

Also raise NotImplementedError in case of not covered scenario instead of
silently ignoring it.
parent 332dda67
...@@ -72,15 +72,16 @@ if computer_partition.getPortalType() == \'Computer Partition\':\n ...@@ -72,15 +72,16 @@ if computer_partition.getPortalType() == \'Computer Partition\':\n
ip_list.append((internet_protocol_address.getNetworkInterface(\'\'), internet_protocol_address.getIpAddress()))\n ip_list.append((internet_protocol_address.getNetworkInterface(\'\'), internet_protocol_address.getIpAddress()))\n
if software_instance is not None and computer_partition is not None and software_release is not None:\n if software_instance is not None and computer_partition is not None and software_release is not None:\n
slave_instance_list = []\n slave_instance_list = []\n
sale_packing_list_line_list = computer_partition.getAggregateRelatedValueList(\n \n
sale_packing_list_line_list = computer_partition.portal_catalog(\n
aggregate_uid=computer_partition.getUid(),\n
portal_type="Sale Packing List Line",\n portal_type="Sale Packing List Line",\n
simulation_state=state_list,\n
default_resource_uid=service_uid_list)\n default_resource_uid=service_uid_list)\n
for sale_packing_list_line in sale_packing_list_line_list:\n for sale_packing_list_line in sale_packing_list_line_list:\n
if sale_packing_list_line.getParent().getSimulationState() not in state_list:\n
continue\n
instance = sale_packing_list_line.getAggregateValue(portal_type=instance_type_list)\n instance = sale_packing_list_line.getAggregateValue(portal_type=instance_type_list)\n
if instance is None:\n if instance is None:\n
continue\n raise NotImplementedError, "Unexpected Sale Packing List without Instance aggregated %s" % sale_packing_list_line.getRelativeUrl()\n
elif instance.getPortalType() == "Slave Instance":\n elif instance.getPortalType() == "Slave Instance":\n
slave_instance = dict(slap_software_type=instance.getSourceReference(),\n slave_instance = dict(slap_software_type=instance.getSourceReference(),\n
slave_reference=instance.getReference(),\n slave_reference=instance.getReference(),\n
......
417 418
\ 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