Commit b6df1552 authored by Łukasz Nowak's avatar Łukasz Nowak

Optimise a bit.

As this is called in a loop, only try to find delivery lines for occupied
partitions.

Otherwise two queries lasting 0.3s each will be called in order to result with
None.
parent 429e937a
...@@ -492,14 +492,18 @@ class SlapTool(BaseTool): ...@@ -492,14 +492,18 @@ class SlapTool(BaseTool):
slap_partition._requested_state = 'destroyed' slap_partition._requested_state = 'destroyed'
slap_partition._need_modification = 0 slap_partition._need_modification = 0
if computer_partition_document.getSlapState() != 'busy':
update_movement = None
movement = None
else:
update_movement = self._getSalePackingListLineForComputerPartition( update_movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document, service_uid_list=[portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()]) computer_partition_document, service_uid_list=[portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()])
movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document)
if update_movement is not None: if update_movement is not None:
if update_movement.getSimulationState() != 'confirmed': if update_movement.getSimulationState() != 'confirmed':
# only confirmed update movements are interesting # only confirmed update movements are interesting
update_movement = None update_movement = None
movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document)
if movement is not None: if movement is not None:
software_release_document = \ software_release_document = \
movement.getAggregateValue(portal_type='Software Release') movement.getAggregateValue(portal_type='Software Release')
......
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