Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
8ef8e6cb
Commit
8ef8e6cb
authored
Jan 06, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BusinessTemplate: backup existing objects overwritten during business template update
parent
1399c8f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
1 deletion
+76
-1
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+2
-1
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+74
-0
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
8ef8e6cb
...
...
@@ -1088,7 +1088,8 @@ class ObjectTemplateItem(BaseTemplateItem):
# old widget, thus we can readd them in
# the right order group
old_groups
[
path
]
=
deepcopy
(
old_obj
.
groups
)
subobjects_dict
=
self
.
_backupObject
(
action
,
trashbin
,
# we force backup since it was an existing object
subobjects_dict
=
self
.
_backupObject
(
'backup'
,
trashbin
,
container_path
,
object_id
)
# in case of portal types, we want to keep some properties
if
interfaces
.
ITypeProvider
.
providedBy
(
container
):
...
...
product/ERP5/tests/testBusinessTemplate.py
View file @
8ef8e6cb
...
...
@@ -3142,9 +3142,29 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
skin_folder
=
self
.
portal
.
portal_skins
[
skin_folder_id
]
skin_folder
.
manage_addProduct
[
'PythonScripts'
].
manage_addPythonScript
(
id
=
python_script_id
)
skin_folder
[
python_script_id
].
ZPythonScript_edit
(
'param=""'
,
'return "body"'
)
sequence
.
set
(
'python_script_id'
,
python_script_id
)
sequence
.
set
(
'skin_folder_id'
,
skin_folder_id
)
def
stepModifyFakeZODBScript
(
self
,
sequence
=
None
,
**
kw
):
script
=
self
.
portal
.
portal_skins
[
sequence
[
'skin_folder_id'
]]
\
[
sequence
[
'python_script_id'
]]
script
.
ZPythonScript_edit
(
'new_param=""'
,
'return "new body"'
)
def
stepCheckFakeZODBScriptIsUpdated
(
self
,
sequence
=
None
,
**
kw
):
script
=
self
.
portal
.
portal_skins
[
sequence
[
'skin_folder_id'
]]
\
[
sequence
[
'python_script_id'
]]
self
.
assertEquals
(
'return "body"
\
n
'
,
script
.
_body
)
def
stepCheckFakeZODBScriptIsBackedUp
(
self
,
sequence
=
None
,
**
kw
):
trash
=
self
.
getTrashTool
()
trash_bin
,
=
trash
.
objectValues
()
backup_script
=
trash_bin
.
portal_skins_items
[
sequence
[
'skin_folder_id'
]]
\
[
sequence
[
'python_script_id'
]]
self
.
assertEquals
(
'return "new body"
\
n
'
,
backup_script
.
_body
)
def
stepAddCustomSkinFolderToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
"""
Add types to business template
...
...
@@ -5545,6 +5565,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
UseImportBusinessTemplate
\
InstallWithoutForceBusinessTemplate
\
Tic
\
RemoveAllTrashBins
\
\
CheckFormGroups
\
\
...
...
@@ -5919,6 +5940,59 @@ class TestBusinessTemplate(BusinessTemplateMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_CheckInstallErasingExistingDocument
(
self
):
""" Installing a business template containing a path that already exist
in the site should overwrite this path after storing it in portal_trash
"""
sequence_list
=
SequenceList
()
sequence_string
=
'
\
RemoveAllTrashBins
\
CreateFakeZODBScript
\
CreateNewBusinessTemplate
\
UseExportBusinessTemplate
\
AddCustomSkinFolderToBusinessTemplate
\
BuildBusinessTemplate
\
ModifyFakeZODBScript
\
SaveBusinessTemplate
\
ImportBusinessTemplate
\
InstallCurrentBusinessTemplate Tic
\
CheckFakeZODBScriptIsUpdated
\
CheckFakeZODBScriptIsBackedUp
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_CheckUpdateErasingExistingDocument
(
self
):
""" Updating a business template containing a path that already exist
in the site should overwrite this path after storing it in portal_trash
"""
sequence_list
=
SequenceList
()
sequence_string
=
'
\
RemoveAllTrashBins
\
CreateFakeZODBScript
\
CreateNewBusinessTemplate
\
UseExportBusinessTemplate
\
BuildBusinessTemplate
\
SaveBusinessTemplate
\
ImportBusinessTemplate
\
InstallCurrentBusinessTemplate Tic
\
ImportBusinessTemplate
\
UseImportBusinessTemplate
\
AddCustomSkinFolderToBusinessTemplate
\
BuildBusinessTemplate
\
ModifyFakeZODBScript
\
SaveBusinessTemplate
\
ImportBusinessTemplate
\
UseImportBusinessTemplate
\
InstallWithoutForceBusinessTemplate Tic
\
CheckFakeZODBScriptIsUpdated
\
CheckFakeZODBScriptIsBackedUp
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_39_CheckSiteProperties
(
self
):
"""Test Site Properties"""
sequence_list
=
SequenceList
()
...
...
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