Commit 0ab74fce authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: configure Allocation Supply Cell predicate

parent 5ba40dd3
line = context.getParentValue()
supply = line.getParentValue()
if (supply.getPortalType() != 'Allocation Supply') or (supply.getValidationState() != 'validated'):
return None
if not context.isAllocable():
return None
base_category_tuple = ('resource', 'software_type', 'software_release', 'destination_project')
if supply.getDestination():
base_category_tuple += ('destination',)
return context.generatePredicate(membership_criterion_base_category_list = base_category_tuple,
criterion_property_list = ('start_date',))
<?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>_params</string> </key>
<value> <string>*args,**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AllocationSupplyCell_asPredicate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -46,15 +46,15 @@ tmp_context = portal.portal_trash.newContent(
resource_value=software_product,
software_type_value=type_variation,
software_release_value=release_variation,
destination_value=context,
destination_project_value=software_product.getFollowUpValue(),
start_date=DateTime()
)
allocation_cell_list = [x.getObject() for x in \
domain_tool.searchPredicateList(
tmp_context, portal_type=['Allocation Supply Cell'],
validation_state='validated',
destination_project__uid=project_uid,
tested_base_category_list=['resource', 'software_type', 'software_release']) if x.isAllocable()]
tmp_context, portal_type=['Allocation Supply Cell'])
if x.isAllocable()]
#context.log('allocation_cell_list %s' % str(allocation_cell_list))
if not allocation_cell_list:
......
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