<?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># Did not import Products.ERP5Security.ERP5GroupManager\n
# because of semantic matter.\n
class ConsistencyError(Exception):\n
  pass\n
\n
predecessor_software_instance = context\n
while (predecessor_software_instance is not None):\n
  root_software_instance = predecessor_software_instance\n
  predecessor_software_instance = predecessor_software_instance.getPredecessorRelatedValue(\n
    portal_type=["Software Instance", "Slave Instance"])\n
\n
root_hosting_subscription = root_software_instance.getPredecessorRelatedValue(\n
  portal_type="Hosting Subscription")\n
\n
# XXX-Antoine: As Romain wanted it, we raise an error if it\'s not attached to a\n
#              root Hosting Subscription.\n
if root_hosting_subscription is None:\n
  # last resort: try to find root hosting subscription by packing list\n
  order_line = root_software_instance.getAggregateRelatedValue(portal_type=\'Sale Order Line\')\n
  if order_line is not None:\n
    root_hosting_subscription = order_line.getAggregateValue(portal_type=\'Hosting Subscription\')\n
  else:\n
    try:\n
      instance_setup_line = root_software_instance.Item_getInstancePackingListLine()\n
    except ValueError:\n
      pass\n
    else:\n
      root_hosting_subscription = instance_setup_line.getAggregateValue(portal_type=\'Hosting Subscription\')\n
  if root_hosting_subscription is None:\n
    raise ConsistencyError(("Software instance %s has no hosting "\n
                          "subscription as root.") % context.getPath())\n
\n
return root_hosting_subscription.getUid()\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>SoftwareInstance_getRootHostingSubscriptionUid</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
