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
Léo-Paul Géneau
slapos.core
Commits
edc5bc69
Commit
edc5bc69
authored
Dec 05, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate computer categories.
parent
e12e82b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
1 deletion
+146
-1
master/bt5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
...5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
+36
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/01_ERP5Site_migrateComputerCategory.xml
...s/slapos_upgrader/01_ERP5Site_migrateComputerCategory.xml
+81
-0
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Computer_migrateCategory.xml
...portal_skins/slapos_upgrader/Computer_migrateCategory.xml
+28
-0
master/bt5/slapos_upgrader/bt/revision
master/bt5/slapos_upgrader/bt/revision
+1
-1
No files found.
master/bt5/slapos_upgrader/ExtensionTemplateItem/SlapOSUpgrader.py
View file @
edc5bc69
...
...
@@ -29,3 +29,39 @@ def Instance_migrateUrlString(self):
real
(
o
[
0
])
else
:
real
(
self
)
def
Computer_migrateCategory
(
self
):
if
self
.
getRelativeUrl
()
==
'computer_module/template_computer'
:
return
portal
=
self
.
getPortalObject
()
def
Computer_updateDestinationSection
(
computer
):
# copy of portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection
subject_list
=
computer
.
getSubjectList
()
person_list
=
[]
for
subject
in
subject_list
:
if
subject
:
person_list
.
extend
([
x
.
getObject
()
for
x
in
portal
.
portal_catalog
(
validation_state
=
"validated"
,
portal_type
=
"Person"
,
default_email_text
=
subject
)])
computer
.
edit
(
destination_section_value_list
=
person_list
)
@
WorkflowMethod
.
disable
def
real
(
self
):
sale_supply_line_list
=
portal
.
portal_catalog
(
portal_type
=
'Sale Supply Line'
,
default_aggregate_uid
=
self
.
getUid
())
assert
(
1
==
len
(
sale_supply_line_list
))
internal_packing_list_line
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Internal Packing List Line'
,
default_aggregate_uid
=
self
.
getUid
(),
sort_on
=
((
'creation_date'
,
'DESC'
),)
)
assert
(
internal_packing_list_line
is
not
None
)
sale_trade_condition
=
sale_supply_line_list
[
0
].
getParentValue
()
self
.
edit
(
source_administration
=
internal_packing_list_line
.
getParentValue
().
getSourceAdministration
(),
subject_list
=
sale_trade_condition
.
getSubjectList
(),
)
Computer_updateDestinationSection
(
self
)
real
(
self
)
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/01_ERP5Site_migrateComputerCategory.xml
0 → 100644
View file @
edc5bc69
<?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>
portal = context.getPortalObject()\n
tag = script.id\n
method_id = \'Computer_migrateCategory\'\n
for module in (\n
portal.computer_module,\n
):\n
module.recurseCallMethod(\n
method_id,\n
max_depth=1,\n
min_depth=1,\n
max_retry=0,\n
activate_kw={\'tag\': script.id}\n
)\n
\n
return \'Done.\'\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
01_ERP5Site_migrateComputerCategory
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_upgrader/SkinTemplateItem/portal_skins/slapos_upgrader/Computer_migrateCategory.xml
0 → 100644
View file @
edc5bc69
<?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>
Computer_migrateCategory
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSUpgrader
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_migrateCategory
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_upgrader/bt/revision
View file @
edc5bc69
9
\ No newline at end of file
10
\ 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