<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string>portal = context.getPortalObject()\n
\n
order = state_change[\'object\']\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
instance_portal_type_list = ["Software Instance","Slave Instance"]\n
for order_line in order.getMovementList():\n
  if order_line.getResource() == setup_service_relative_url:\n
    computer_partition = order_line.getAggregateValue(portal_type="Computer Partition")\n
    if computer_partition is None:\n
      software_release = order_line.getAggregateValue(portal_type="Software Release")\n
      software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n
\n
      hosting_subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
      open_order_line = portal.portal_catalog.getResultValue(\n
        portal_type="Open Sale Order Line",\n
        validation_state="validated",\n
        aggregate_relative_url=hosting_subscription.getRelativeUrl(),\n
        destination_section_relative_url=order.getDestinationSection())\n
      if open_order_line is not None:\n
        open_order = open_order_line.getParentValue()\n
        computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
          open_order=open_order,\n
          callable_object=open_order.OpenSaleOrder_findPartition,\n
          argument_list=[software_release.getUrlString(), software_instance.getSourceReference(),\n
          software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
        order_line.edit(\n
          aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>state_change, **kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Delivery_assignComputerPartition</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
