<?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>from DateTime import DateTime\n
\n
if context.getSimulationState() != \'stopped\':\n
  return \n
\n
if context.UpgradeDecision_isUpgradeFinished():\n
  return \n
\n
portal = context.getPortalObject()\n
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if not person:\n
  raise ValueError("Inconsistent Upgrade Decision, No Destination Decision")\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
software_product_title = software_release.getAggregateTitle(\n
                               portal_type="Software Product")\n
\n
reference = context.getReference()\n
\n
mapping_dict = {\n
  \'software_product_title\': software_product_title,\n
  \'software_release_name\': software_release.getTitle(),\n
  \'software_release_reference\': software_release.getReference(),\n
  \'new_software_release_url\': software_release.getUrlString(),\n
}\n
\n
if hosting_subscription is not None:\n
  notification_message_reference = \'slapos-upgrade-delivered-hosting-subscription.notification\'\n
  title = "Upgrade Processed for %s (%s)" % (hosting_subscription.getTitle(), \n
                                              software_release.getReference())\n
  mapping_dict.update(**{\n
     \'hosting_subscription_title\': hosting_subscription.getTitle(),\n
     \'old_software_release_url\': hosting_subscription.getUrlString()})\n
\n
elif computer is not None:\n
\n
  notification_message_reference = \'slapos-upgrade-delivered-computer.notification\' \n
\n
  title = "Upgrade processed at %s for %s" % (computer.getTitle(), software_release.getReference()) \n
  mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
                         \'computer_reference\': computer.getReference()})\n
\n
\n
if notification_message_reference is None:\n
  raise ValueError("No Notification Message")\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
                 reference=notification_message_reference)\n
\n
message = notification_message.asEntireHTML(\n
            substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
\n
event = context.SupportRequest_trySendNotificationMessage(title,\n
              message, person.getRelativeUrl())\n
\n
if event is not None:\n
  context.deliver()\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>**kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>UpgradeDecision_notifyDelivered</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
