Commit 3bffc8d2 authored by Antoine Catton's avatar Antoine Catton

Modify bang in order to bang the tree from root instance.

parent 0eb82799
......@@ -53,15 +53,18 @@
<value> <string>software_instance = state_change[\'object\']\n
portal = context.getPortalObject()\n
\n
root_software_instance = software_instance\n
while (software_instance is not None):\n
root_software_instance = software_instance\n
software_instance = software_instance.getPredecessorRelatedValue()\n
root_hosting_subscription = portal.portal_catalog.getResultValue(uid=context.SoftwareInstance_getRootHostingSubscriptionUid)\n
root_software_instance = root_hosting_subscription.HostingSubscription_requestRootSoftwareInstance()\n
\n
for software_instance in context.portal_catalog(\n
portal_type=\'Software Instance\',\n
root_uid=root_software_instance.getUid()):\n
software_instance = software_instance.getObject()\n
# Use iterative algorithm instead of recursive approach in order to avoid\n
# complexity as much as possible.\n
flat_tree = [root_software_instance]\n
while True:\n
try:\n
software_instance = flat_tree.pop(0)\n
except:\n
break\n
flat_tree.extend(software_instance.getPredecessorValueList())\n
try:\n
software_instance.Item_getInstancePackingListLine(service_relative_url=portal.portal_preferences.getPreferredInstanceCleanupResource())\n
except ValueError:\n
......
328
\ No newline at end of file
329
\ 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