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

portal = context.getPortalObject()\n
product_reference = context.getAggregateReference()\n
\n
decision_line_in_progress_list = portal.portal_catalog(\n
                    portal_type=\'Upgrade Decision Line\',\n
                    default_aggregate_uid=aggregate_uid)\n
\n
for decision_line in decision_line_in_progress_list:\n
  upgrade_decision = decision_line.getParentValue()\n
  simulation_state = upgrade_decision.getSimulationState()\n
  if simulation_state not in [\'planned\', \'confirmed\',\n
      \'started\', \'stopped\', \'rejected\']:\n
    continue\n
  release_list = decision_line.getAggregateValueList(portal_type="Software Release")\n
  if len(release_list) > 1:\n
    continue\n
  if not release_list[0]:\n
    continue\n
  # If the current sr in rejected we must prevent creation of new upgrade decision for this sr\n
  if simulation_state == \'rejected\' and \\\n
        release_list[0].getUrlString() != context.getUrlString():\n
    continue\n
    \n
  # If both software release belong to the same software product, there is an upgrade decision in progress \n
  if product_reference == release_list[0].getAggregateReference():\n
    return upgrade_decision\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>aggregate_uid</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>SoftwareRelease_getUpgradeDecisionInProgress</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
