Commit 304c91b3 authored by Gabriel Monnerat's avatar Gabriel Monnerat

fix variable name according to your context

parent feae0415
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n
hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n hosting_subscription = slave_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n
portal = software_instance.getPortalObject()\n portal = slave_instance.getPortalObject()\n
\n \n
# Get services\n # Get services\n
portal_preferences = portal.portal_preferences\n portal_preferences = portal.portal_preferences\n
......
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
software_instance.Base_checkConsistency()\n slave_instance.Base_checkConsistency()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
instance_setup_sale_packing_list_line = \\\n instance_setup_sale_packing_list_line = \\\n
context.SlaveInstance_getInstancePackingListLine(\n context.SlaveInstance_getInstancePackingListLine(\n
state_change, \n state_change, \n
service_relative_url=software_instance.portal_preferences.\\\n service_relative_url=slave_instance.portal_preferences.\\\n
getPreferredInstanceSetupResource())\n getPreferredInstanceSetupResource())\n
instance_setup_sale_packing_list = instance_setup_sale_packing_list_line.getParentValue()\n instance_setup_sale_packing_list = instance_setup_sale_packing_list_line.getParentValue()\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceHostingResource()\n getPreferredInstanceHostingResource()\n
return context.SlaveInstance_getInstancePackingListLine(\n return context.SlaveInstance_getInstancePackingListLine(\n
......
...@@ -50,9 +50,9 @@ ...@@ -50,9 +50,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
\n \n
portal = software_instance.getPortalObject()\n portal = slave_instance.getPortalObject()\n
\n \n
# Get services\n # Get services\n
portal_preferences = portal.portal_preferences\n portal_preferences = portal.portal_preferences\n
...@@ -79,15 +79,14 @@ state_list.extend(portal.getPortalCurrentInventoryStateList())\n ...@@ -79,15 +79,14 @@ state_list.extend(portal.getPortalCurrentInventoryStateList())\n
packing_list_line = portal.portal_catalog.getResultValue(\n packing_list_line = portal.portal_catalog.getResultValue(\n
portal_type=\'Sale Packing List Line\',\n portal_type=\'Sale Packing List Line\',\n
simulation_state=state_list,\n simulation_state=state_list,\n
aggregate_uid=software_instance.getUid(),\n aggregate_uid=slave_instance.getUid(),\n
default_resource_uid=service_uid_list,\n default_resource_uid=service_uid_list,\n
sort_on=((\'movement.start_date\', \'DESC\'),),\n sort_on=((\'movement.start_date\', \'DESC\'),),\n
limit=1,\n limit=1,\n
)\n )\n
\n \n
if packing_list_line is None:\n if packing_list_line is None:\n
raise ValueError("No sale packing list line found for %s" % \\\n raise ValueError("No sale packing list line found for %s - %s" % (slave_instance.getRelativeUrl(),slave_instance.getPortalType()))\n
software_instance.getRelativeUrl())\n
else:\n else:\n
return packing_list_line\n return packing_list_line\n
</string> </value> </string> </value>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n <value> <string>slave_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceSetupResource()\n getPreferredInstanceSetupResource()\n
return context.SlaveInstance_getInstancePackingListLine(\n return context.SlaveInstance_getInstancePackingListLine(\n
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
from DateTime import DateTime\n from DateTime import DateTime\n
import random\n import random\n
\n \n
software_instance = state_change[\'object\']\n slave_instance = state_change[\'object\']\n
software_release_url_string = state_change.kwargs[\'software_release\']\n software_release_url_string = state_change.kwargs[\'software_release\']\n
hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n
shared = state_change.kwargs[\'shared\']\n shared = state_change.kwargs[\'shared\']\n
...@@ -64,9 +64,9 @@ tag = state_change.kwargs[\'tag\']\n ...@@ -64,9 +64,9 @@ tag = state_change.kwargs[\'tag\']\n
filter_kw = state_change.kwargs["filter_kw"]\n filter_kw = state_change.kwargs["filter_kw"]\n
\n \n
# Assertion: No packing list line should be related to this software instance\n # Assertion: No packing list line should be related to this software instance\n
packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n packing_list_line = slave_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
if packing_list_line is not None:\n if packing_list_line is not None:\n
raise ValueError("Software Instance %s is already associated to a packing list line" % software_instance.getRelativeurl())\n raise ValueError("Software Instance %s is already associated to a packing list line" % slave_instance.getRelativeurl())\n
\n \n
# Find a free computer partition. This means:\n # Find a free computer partition. This means:\n
# Computer Partition which doesn\'t have non delivered sale packing list related\n # Computer Partition which doesn\'t have non delivered sale packing list related\n
...@@ -83,16 +83,16 @@ if "computer_guid" in filter_kw:\n ...@@ -83,16 +83,16 @@ if "computer_guid" in filter_kw:\n
query_kw["parent_reference"] = filter_kw["computer_guid"]\n query_kw["parent_reference"] = filter_kw["computer_guid"]\n
\n \n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n # fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = software_instance.getPortalObject().portal_workflow.isTransitionPossible\n isTransitionPossible = slave_instance.getPortalObject().portal_workflow.isTransitionPossible\n
query_kw.update(free_for_request=1) # is free\n query_kw.update(free_for_request=1) # is free\n
result_count = software_instance.portal_catalog.countResults(**query_kw)[0][0]\n result_count = slave_instance.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n offset = max(0, result_count-1)\n
if offset >= SQL_WINDOW_SIZE:\n if offset >= SQL_WINDOW_SIZE:\n
limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n
else:\n else:\n
limit = (0, SQL_WINDOW_SIZE)\n limit = (0, SQL_WINDOW_SIZE)\n
\n \n
for computer_partition_candidate in software_instance.portal_catalog(\n for computer_partition_candidate in slave_instance.portal_catalog(\n
limit=limit, **query_kw):\n limit=limit, **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject()\n computer_partition_candidate = computer_partition_candidate.getObject()\n
# Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n # Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n
...@@ -112,7 +112,7 @@ software_release_document = context.portal_catalog.getResultValue(\n ...@@ -112,7 +112,7 @@ software_release_document = context.portal_catalog.getResultValue(\n
# protect computer partition from being selected again\n # protect computer partition from being selected again\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n hosting_subscription = slave_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n
sale_packing_list_line = context.HostingSubscription_getInstancePackingListLine(state_change)\n sale_packing_list_line = context.HostingSubscription_getInstancePackingListLine(state_change)\n
base_sale_packing_list = sale_packing_list_line.getParentValue()\n base_sale_packing_list = sale_packing_list_line.getParentValue()\n
# XXX: SlaveInstance_createSalePackingList shall be used to create new Sale Packing List\n # XXX: SlaveInstance_createSalePackingList shall be used to create new Sale Packing List\n
...@@ -135,7 +135,7 @@ sale_packing_list = sale_packing_list_module.newContent(\n ...@@ -135,7 +135,7 @@ sale_packing_list = sale_packing_list_module.newContent(\n
sale_packing_list_line = sale_packing_list.newContent(\n sale_packing_list_line = sale_packing_list.newContent(\n
portal_type=\'Sale Packing List Line\',\n portal_type=\'Sale Packing List Line\',\n
resource=context.portal_preferences.getPreferredInstanceSetupResource(),\n resource=context.portal_preferences.getPreferredInstanceSetupResource(),\n
aggregate_value_list=[software_instance, software_release_document, computer_partition, hosting_subscription]\n aggregate_value_list=[slave_instance, software_release_document, computer_partition, hosting_subscription]\n
)\n )\n
\n \n
# confirm Sale Packing List\n # confirm Sale Packing List\n
......
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
software_instance = state_change[\'object\']\n slave_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n service_relative_url = slave_instance.portal_preferences.\\\n
getPreferredInstanceHostingResource()\n getPreferredInstanceHostingResource()\n
need_to_create_packing_list = False\n need_to_create_packing_list = False\n
try:\n try:\n
...@@ -75,11 +75,11 @@ else:\n ...@@ -75,11 +75,11 @@ else:\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
if need_to_create_packing_list:\n if need_to_create_packing_list:\n
tag = "%s_startInProgress" % software_instance.getUid()\n tag = "%s_startInProgress" % slave_instance.getUid()\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
raise ValueError("Slave Instance is currently being started.")\n raise ValueError("Slave Instance is currently being started.")\n
# lock software instance in transaction\n # lock software instance in transaction\n
software_instance.serialize()\n slave_instance.serialize()\n
sale_packing_list = context.SlaveInstance_createSalePackingList(state_change, service_relative_url, tag)\n sale_packing_list = context.SlaveInstance_createSalePackingList(state_change, service_relative_url, tag)\n
sale_packing_list.confirm(activate_kw={\'tag\':tag})\n sale_packing_list.confirm(activate_kw={\'tag\':tag})\n
......
249 250
\ 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