<?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>sale_packing_list_line = context\n
instance_type_list = [\'Software Instance\', \'Slave Instance\']\n
\n
hosting_service = context.restrictedTraverse(\n
  context.portal_preferences.getPreferredInstanceHostingResource())\n
setup_service = context.restrictedTraverse(\n
  context.portal_preferences.getPreferredInstanceSetupResource())\n
update_service = context.restrictedTraverse(\n
  context.portal_preferences.getPreferredInstanceUpdateResource())\n
\n
service_uid_list = [hosting_service.getUid(), setup_service.getUid(), update_service.getUid()]\n
\n
state_list = ("confirmed", "started")\n
\n
software_instance = sale_packing_list_line.getAggregateValue(portal_type=instance_type_list)\n
computer_partition = sale_packing_list_line.getAggregateValue(portal_type=\'Computer Partition\')\n
software_release = sale_packing_list_line.getAggregateValue(portal_type="Software Release")\n
\n
ip_list = []\n
if computer_partition.getPortalType() == \'Computer Partition\':\n
  for internet_protocol_address in computer_partition.contentValues(portal_type=\'Internet Protocol Address\'):\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
  slave_instance_list = []\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
    simulation_state=state_list,\n
    default_resource_uid=service_uid_list)\n
  for sale_packing_list_line in sale_packing_list_line_list:\n
    instance = sale_packing_list_line.getAggregateValue(portal_type=instance_type_list)\n
    if instance is None:\n
      raise NotImplementedError, "Unexpected Sale Packing List without Instance aggregated %s" % sale_packing_list_line.getRelativeUrl()\n
    elif instance.getPortalType() == "Slave Instance":\n
      slave_instance = dict(slap_software_type=instance.getSourceReference(),\n
                            slave_reference=instance.getReference(),\n
                            xml=instance.getTextContent(),\n
                            connection_xml=instance.getConnectionXml(),\n
                            )\n
      if slave_instance not in slave_instance_list:\n
        slave_instance_list.append(slave_instance)\n
    elif instance.getPortalType() == "Software Instance":\n
      software_instance = instance\n
  return {\n
    \'xml\':software_instance.getTextContent(),\n
    \'connection_xml\':software_instance.getConnectionXml(),\n
    \'slap_computer_id\':computer_partition.getParentValue().getReference(),\n
    \'slap_computer_partition_id\':computer_partition.getReference(),\n
    \'slap_software_type\': software_instance.getSourceReference(),\n
    \'slap_software_release_url\':software_release.getUrlString(),\n
    \'slave_instance_list\': slave_instance_list,\n
    \'ip_list\':ip_list,\n
  }\n
\n
return None\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>SalePackinListLine_asSoftwareInstnaceComputerPartitionMergedDict</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
