Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Yusei Tahara
erp5
Commits
e6232b04
Commit
e6232b04
authored
Mar 06, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When migrating Components from filesystem to ZODB, allow to specify version per Component.
parent
476ce70e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
59 deletions
+66
-59
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+28
-42
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
...core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
+14
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml
...essTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml
+3
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/listbox.xml
...ate_viewMigrateSourceCodeFromFilesystemDialog/listbox.xml
+11
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/listbox_version_item_list.xml
...rceCodeFromFilesystemDialog/listbox_version_item_list.xml
+6
-10
product/ERP5/bootstrap/erp5_core/bt/change_log
product/ERP5/bootstrap/erp5_core/bt/change_log
+3
-0
product/ERP5/bootstrap/erp5_core/bt/revision
product/ERP5/bootstrap/erp5_core/bt/revision
+1
-1
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
e6232b04
...
...
@@ -5904,58 +5904,44 @@ Business Template is a set of definitions, such as skins, portal types and categ
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'migrateSourceCodeFromFilesystem'
)
def
migrateSourceCodeFromFilesystem
(
self
,
version_priority
,
component_portal_type_dict
,
erase_existing
=
False
,
**
kw
):
if
not
component_portal_type_dict
:
return
{}
component_tool
=
self
.
getPortalObject
().
portal_components
failed_import_dict
=
{}
# XXX-arnau: dirty because of copy/paste but will be refactor
# later with Products anyway...
from
Products.ERP5Type.Core.DocumentComponent
import
DocumentComponent
document_id_list
=
self
.
getTemplateDocumentIdList
()
for
i
,
reference
in
enumerate
(
document_id_list
):
def
migrate
(
component_dict
,
component_class
,
template_id_list_method
):
migrated_id_list
=
[]
for
reference
,
version
in
component_dict
.
iteritems
():
try
:
obj
=
DocumentComponent
.
importFromFilesystem
(
component_tool
,
obj
=
component_class
.
importFromFilesystem
(
component_tool
,
reference
,
version
_priority
,
version
,
erase_existing
)
except
Exception
,
e
:
failed_import_dict
[
reference
]
=
str
(
e
)
else
:
document_id_list
[
i
]
=
obj
.
getId
(
)
migrated_id_list
.
append
(
obj
.
getId
()
)
self
.
setTemplateDocumentIdList
(
document_id_list
)
if
migrated_id_list
:
template_id_list_method
(
migrated_id_list
)
from
Products.ERP5Type.Core.ExtensionComponent
import
ExtensionComponent
extension_id_list
=
self
.
getTemplateExtensionIdList
()
for
i
,
reference
in
enumerate
(
extension_id_list
):
try
:
obj
=
ExtensionComponent
.
importFromFilesystem
(
component_tool
,
reference
,
version_priority
,
erase_existing
)
except
Exception
,
e
:
failed_import_dict
[
reference
]
=
str
(
e
)
else
:
extension_id_list
[
i
]
=
obj
.
getId
()
component_dict
=
component_portal_type_dict
.
get
(
'Document Component'
)
if
component_dict
:
from
Products.ERP5Type.Core.DocumentComponent
import
DocumentComponent
migrate
(
component_dict
,
DocumentComponent
,
self
.
setTemplateDocumentIdList
)
self
.
setTemplateExtensionIdList
(
extension_id_list
)
component_dict
=
component_portal_type_dict
.
get
(
'Extension Component'
)
if
component_dict
:
from
Products.ERP5Type.Core.ExtensionComponent
import
ExtensionComponent
migrate
(
component_dict
,
ExtensionComponent
,
self
.
setTemplateExtensionIdList
)
component_dict
=
component_portal_type_dict
.
get
(
'Test Component'
)
if
component_dict
:
from
Products.ERP5Type.Core.TestComponent
import
TestComponent
test_id_list
=
self
.
getTemplateTestIdList
()
for
i
,
reference
in
enumerate
(
test_id_list
):
try
:
obj
=
TestComponent
.
importFromFilesystem
(
component_tool
,
reference
,
version_priority
,
erase_existing
)
except
Exception
,
e
:
failed_import_dict
[
reference
]
=
str
(
e
)
else
:
test_id_list
[
i
]
=
obj
.
getId
()
self
.
setTemplateTestIdList
(
test_id_list
)
migrate
(
component_dict
,
TestComponent
,
self
.
setTemplateTestIdList
)
return
failed_import_dict
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_migrateSourceCodeFromFilesystem.xml
View file @
e6232b04
...
...
@@ -50,7 +50,19 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
failed_import_dict = context.migrateSourceCodeFromFilesystem(version_priority, erase_existing, **kw)\n
<value>
<string>
request = context.REQUEST\n
object_list = context.portal_selections.getSelectionValueList(selection_name=request[\'listbox_list_selection_name\'],\n
context=context,\n
REQUEST=request)\n
\n
listbox_dict = request[\'listbox\']\n
\n
component_dict = {}\n
for object in object_list:\n
component_dict.setdefault(object.destination_portal_type,\n
{})[object.getUid()] = listbox_dict[object.getUrl()][\'version_item_list\']\n
\n
failed_import_dict = context.migrateSourceCodeFromFilesystem(component_dict, erase_existing, **kw)\n
\n
if failed_import_dict:\n
failed_import_formatted_list = []\n
...
...
@@ -67,7 +79,7 @@ return context.Base_redirect(\'view\',\n
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
version_priority,
erase_existing=False, **kw
</string>
</value>
<value>
<string>
erase_existing=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog.xml
View file @
e6232b04
...
...
@@ -88,14 +88,15 @@
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
<list>
<string>
listbox_version_item_list
</string>
</list>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_version_priority
</string>
<string>
my_erase_existing
</string>
</list>
</value>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/listbox.xml
View file @
e6232b04
...
...
@@ -409,6 +409,10 @@
<string>
destination_portal_type
</string>
<string>
Destination Portal Type
</string>
</tuple>
<tuple>
<string>
version_item_list
</string>
<string>
Version
</string>
</tuple>
</list>
</value>
</item>
...
...
@@ -457,7 +461,12 @@
<item>
<key>
<string>
editable_columns
</string>
</key>
<value>
<list/>
<list>
<tuple>
<string>
version_item_list
</string>
<string>
Version
</string>
</tuple>
</list>
</value>
</item>
<item>
...
...
@@ -550,7 +559,7 @@
</item>
<item>
<key>
<string>
selection_name
</string>
</key>
<value>
<string>
business_template_migrate_
all_component
_from_filesystem_view_component_list_selection
</string>
</value>
<value>
<string>
business_template_migrate_
source_code
_from_filesystem_view_component_list_selection
</string>
</value>
</item>
<item>
<key>
<string>
sort
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/
my_version_priority
.xml
→
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/
listbox_version_item_list
.xml
View file @
e6232b04
...
...
@@ -10,15 +10,15 @@
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
first_item
</string>
<string>
items
</string>
<string>
size
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
my_version_priority
</string>
</value>
<value>
<string>
listbox_version_item_list
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
...
...
@@ -72,10 +72,6 @@
<key>
<string>
target
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -87,10 +83,6 @@
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_list_field
</string>
</value>
</item>
<item>
<key>
<string>
first_item
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
...
...
@@ -101,6 +93,10 @@
<list/>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
target
</string>
</key>
<value>
<string>
Click to edit the target
</string>
</value>
...
...
product/ERP5/bootstrap/erp5_core/bt/change_log
View file @
e6232b04
2012-03-06 arnaud.fontaine
* Allow to specify version per Components in migration view.
2012-03-06 arnaud.fontaine
* Show Component versions defined on the BusinessTemplate in ZODB Migration view.
...
...
product/ERP5/bootstrap/erp5_core/bt/revision
View file @
e6232b04
41028
\ No newline at end of file
41029
\ 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