<?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 encoding="cdata"><![CDATA[

"""Add selected product to the cart and continue"""\n
portal = context.getPortalObject()\n
\n
if len(uids) != 1:\n
  return context.Base_redirect(dialog_id,\n
                        keep_items={\'portal_status_message\':context.Base_translateString("Please select one service.")})\n
\n
if not service_title:\n
  return context.Base_redirect(dialog_id,\n
                        keep_items={\'portal_status_message\':context.Base_translateString("You have to provide Service Title.")})\n
\n
cleanup_resource = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
software_instance_list = []\n
for software_instance in context.portal_catalog(\n
  portal_type=[\'Software Instance\', \'Slave Instance\'],\n
  select_expression=\'title\',\n
  title={\'query\': service_title, \'key\': \'ExactMatch\'}\n
):\n
  try:\n
    cleanup_delivery_line = software_instance.Item_getInstancePackingListLine(cleanup_resource)\n
  except ValueError:\n
    software_instance_list.append(software_instance)\n
    break\n
  else:\n
    if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
      software_instance_list.append(software_instance)\n
      break\n
\n
if len(software_instance_list) > 0:\n
  return context.Base_redirect(dialog_id,\n
                        keep_items={\'portal_status_message\':context.Base_translateString(\n
                          "You already have service named ${service_title}. Please choose different unique name.", mapping={\'service_title\': service_title})})\n
\n
session = context.WebSection_getVifibSession()\n
params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n
params["instance_software_product_uid"] = uids[0]\n
params["service_title"] = service_title\n
params["instance_xml"] = instance_xml\n
params["shared"] = shared\n
params["computer"] = computer\n
portal.portal_selections.setSelectionParamsFor(\'vifib_session_id\', params)\n
\n
if kw.has_key(\'came_from\'):\n
  #we override the context to redirect the user to the next web section\n
  context = portal.restrictedTraverse(kw[\'came_from\'])\n
  \n
context.WebSection_viewNextStep()\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>dialog_id, service_title, instance_xml, computer=\'\', uids=[], shared=0, quantity=1, reset_shopping_cart=True, **kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>WebSection_addSelectedSoftwareProductToShoppingCart</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
