Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
slapos.core
Commits
5c5e5156
Commit
5c5e5156
authored
Mar 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop yet another part of spaghetti.
While *trying* to confirm order *try* to assign partition.
parent
7ab1bb4c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
211 deletions
+45
-211
master/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+0
-4
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assign_computer_partition.xml
...ction_workflow/interactions/assign_computer_partition.xml
+0
-96
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml
...ion_workflow/scripts/Delivery_assignComputerPartition.xml
+0
-99
master/bt5/vifib_open_trade/bt/revision
master/bt5/vifib_open_trade/bt/revision
+1
-1
master/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list
...ib_open_trade/bt/template_portal_type_workflow_chain_list
+0
-1
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
...skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
+43
-9
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
No files found.
master/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
View file @
5c5e5156
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
<type>
Purchase Packing List
</type>
<type>
Purchase Packing List
</type>
<workflow>
vifib_open_order_interaction_workflow
</workflow>
<workflow>
vifib_open_order_interaction_workflow
</workflow>
</chain>
</chain>
<chain>
<type>
Sale Order
</type>
<workflow>
vifib_open_order_interaction_workflow
</workflow>
</chain>
<chain>
<chain>
<type>
Subscription Item Root Simulation Rule
</type>
<type>
Subscription Item Root Simulation Rule
</type>
<workflow>
edit_workflow, rule_validation_workflow
</workflow>
<workflow>
edit_workflow, rule_validation_workflow
</workflow>
...
...
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assign_computer_partition.xml
deleted
100644 → 0
View file @
7ab1bb4c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"InteractionDefinition"
module=
"Products.ERP5.Interaction"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
activate_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
assign_computer_partition
</string>
</value>
</item>
<item>
<key>
<string>
method_id
</string>
</key>
<value>
<list>
<string>
confirm
</string>
</list>
</value>
</item>
<item>
<key>
<string>
once_per_transaction
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
portal_type_filter
</string>
</key>
<value>
<list>
<string>
Sale Order
</string>
</list>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<list>
<string>
Delivery_assignComputerPartition
</string>
</list>
</value>
</item>
<item>
<key>
<string>
temporary_document_disallowed
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml
deleted
100644 → 0
View file @
7ab1bb4c
<?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 zExceptions import Unauthorized\n
portal = context.getPortalObject()\n
\n
order = state_change[\'object\']\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
instance_portal_type_list = ["Software Instance","Slave Instance"]\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
computer_partition = order_line.getAggregateValue(portal_type="Computer Partition")\n
if computer_partition is None:\n
if not order.Delivery_isDestinationSectionAllowedToRequest():\n
raise Unauthorized(\'Request disallowed\')\n
software_release = order_line.getAggregateValue(portal_type="Software Release")\n
software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n
\n
hosting_subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
open_order_line = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order Line",\n
validation_state="validated",\n
aggregate_relative_url=hosting_subscription.getRelativeUrl(),\n
destination_section_relative_url=order.getDestinationSection())\n
if open_order_line is not None:\n
open_order = open_order_line.getParentValue()\n
computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
open_order=open_order,\n
callable_object=open_order.OpenSaleOrder_findPartition,\n
argument_list=[software_release.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Delivery_assignComputerPartition
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_open_trade/bt/revision
View file @
5c5e5156
169
170
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list
View file @
5c5e5156
Hosting Subscription | edit_workflow
Hosting Subscription | edit_workflow
Hosting Subscription | hosting_subscription_workflow
Hosting Subscription | hosting_subscription_workflow
Purchase Packing List | vifib_open_order_interaction_workflow
Purchase Packing List | vifib_open_order_interaction_workflow
Sale Order | vifib_open_order_interaction_workflow
Subscription Item Root Simulation Rule | edit_workflow
Subscription Item Root Simulation Rule | edit_workflow
Subscription Item Root Simulation Rule | rule_validation_workflow
Subscription Item Root Simulation Rule | rule_validation_workflow
\ No newline at end of file
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml
View file @
5c5e5156
...
@@ -53,22 +53,56 @@
...
@@ -53,22 +53,56 @@
<value>
<string>
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
<value>
<string>
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from zExceptions import Unauthorized\n
from zExceptions import Unauthorized\n
\n
\n
def assignComputerPartition(order):\n
portal = context.getPortalObject()\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
instance_portal_type_list = ["Software Instance","Slave Instance"]\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
computer_partition = order_line.getAggregateValue(portal_type="Computer Partition")\n
if computer_partition is None:\n
if not order.Delivery_isDestinationSectionAllowedToRequest():\n
raise Unauthorized(\'Request disallowed\')\n
software_release = order_line.getAggregateValue(portal_type="Software Release")\n
software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n
\n
hosting_subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
open_order_line = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order Line",\n
validation_state="validated",\n
aggregate_relative_url=hosting_subscription.getRelativeUrl(),\n
destination_section_relative_url=order.getDestinationSection())\n
if open_order_line is not None:\n
open_order = open_order_line.getParentValue()\n
computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
open_order=open_order,\n
callable_object=open_order.OpenSaleOrder_findPartition,\n
argument_list=[software_release.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
\n
sale_order = context.getParentValue()\n
sale_order = context.getParentValue()\n
if sale_order.getSimulationState() == \'ordered\':\n
if sale_order.getSimulationState() == \'ordered\':\n
try:\n
try:\n
sale_order.Base_checkConsistency()\n
assignComputerPartition(sale_order)\n
except ValidationFailed:\n
except ValueError:\n
# order not ready yet\n
# It was not possible to find free Computer Partition\n
pass\n
except Unauthorized:\n
# user has bad balance\n
pass\n
pass\n
else:\n
else:\n
try:\n
try:\n
sale_order.confirm()\n
sale_order.Base_checkConsistency()\n
except ValueError:\n
except ValidationFailed:\n
# It was not possible to find free Computer Partition\n
# order not ready yet\n
pass\n
except Unauthorized:\n
# user has bad balance\n
pass\n
pass\n
else:\n
sale_order.confirm()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/vifib_slap/bt/revision
View file @
5c5e5156
624
625
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment