Commit 759e78d1 authored by Romain Courteaud's avatar Romain Courteaud

Garbage collect hosting subscription to prevent getting the same title twice in validated state.

parent d366868b
......@@ -242,6 +242,31 @@ def SlapDocument_migrateSlapState(self):
# Update Local Roles
slap_document.updateLocalRolesOnSecurityGroups()
real(self)
def HostingSubscription_garbageCollectForMigration(self):
@WorkflowMethod.disable
def real(self):
slap_document = self
portal = self.getPortalObject()
title = slap_document.getTitle()
instance_state = 'destroy_requested'
for software_instance in slap_document.getPredecessorValueList():
if software_instance.getTitle() == title:
if software_instance.getSlapState() != 'destroy_requested':
instance_state = software_instance.getSlapState()
break
if instance_state == 'destroy_requested':
_jumpToStateFor = portal.portal_workflow._jumpToStateFor
_jumpToStateFor(slap_document, instance_state, 'instance_slap_interface_workflow')
assert(slap_document.getSlapState() == instance_state)
_jumpToStateFor(slap_document, 'archived', 'hosting_subscription_workflow')
assert(slap_document.getValidationState() == 'archived')
# Update Local Roles
slap_document.updateLocalRolesOnSecurityGroups()
real(self)
def SalePackingListLine_deliver(self):
@WorkflowMethod.disable
......
<?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>context.getPortalObject().portal_catalog.searchAndActivate(\n
portal_type=[\'Hosting Subscription\'],\n
validation_state=\'validated\',\n
method_id=\'HostingSubscription_garbageCollectForMigration\'\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_garbageCollectHostingSubscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>HostingSubscription_garbageCollectForMigration</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibUpgrader</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_garbageCollectForMigration</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
116
\ No newline at end of file
117
\ 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