<?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[

if reference is None:\n
  raise ValueError("Missing Reference")\n
\n
portal = context.getPortalObject()\n
\n
upgrade_decision_list = portal.portal_catalog(\n
  portal_type="Upgrade Decision", \n
  reference=reference, limit=2)\n
\n
if not len(upgrade_decision_list):\n
  return context.Base_redirect("", \n
    keep_items={"portal_status_message": \n
       context.Base_translateString("Unable to find the Upgrade Decision.")})\n
\n
if len(upgrade_decision_list) > 1:\n
  raise ValueError("Duplicated reference for %s. Please contact site administrators." % reference)\n
\n
upgrade_decision = upgrade_decision_list[0]\n
\n
if upgrade_decision.getSimulationState() in [\'draft\', \'planned\']:\n
  message = "Sorry, the upgrade is not possible yet!"\n
\n
elif upgrade_decision.getSimulationState() in [\'cancelled\', \'rejected\']:\n
  message = "Sorry, the upgrade is not possble, Upgrade Decision was Canceled or Rejected!"\n
\n
elif upgrade_decision.getSimulationState() == \'started\':\n
  message = "This Upgrade Decision is already Started."\n
\n
elif upgrade_decision.getSimulationState() in [\'stopped\', \'delivered\']:\n
  message = "This Upgrade Decision has been already processed."\n
\n
elif upgrade_decision.getSimulationState() == \'confirmed\':\n
  message = "This Upgrade Decision has been requested, it will be processed in few minutes."\n
  upgrade_decision.start()\n
\n
return context.Base_redirect("", \n
    keep_items={"portal_status_message": \n
       context.Base_translateString(message)})\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>reference</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Base_acceptUpgradeDecision</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
