Commit 353d25ea authored by Romain Courteaud's avatar Romain Courteaud

Drop SoftwareInstance_getRootHostingSubscriptionUid

parent 198e2463
<?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>
449
\ No newline at end of file
450
\ No newline at end of file
......@@ -15,7 +15,7 @@
<item>
<key> <string>arguments_src</string> </key>
<value> <string>uid\r\n
SoftwareInstance_getRootHostingSubscriptionUid</string> </value>
getSpecialiseUid</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
......@@ -69,7 +69,7 @@ WHERE\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-call expr="row_list.append([\n
uid[loop_item],\n
SoftwareInstance_getRootHostingSubscriptionUid[loop_item]])">\n
getSpecialiseUid[loop_item]])">\n
</dtml-in>\n
\n
<dtml-if "row_list">\n
......
37
\ No newline at end of file
38
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment