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
Frederic Thoma
erp5
Commits
4df1d2db
Commit
4df1d2db
authored
Mar 20, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Instead of raising error one by one, collect in error_list
parent
27afa42c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+13
-10
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
4df1d2db
...
...
@@ -33,6 +33,7 @@ from App.config import getConfiguration
import
os
import
shutil
import
sys
import
hashlib
from
Acquisition
import
Implicit
,
Explicit
from
AccessControl
import
ClassSecurityInfo
...
...
@@ -1752,12 +1753,15 @@ class TemplateTool (BaseTool):
installation_process
.
_path_item_list
=
to_install_path_item_list
self
.
compareOldStateToOFS
(
installation_process
,
old_installation_state
)
error_list
=
self
.
compareOldStateToOFS
(
installation_process
,
old_installation_state
)
# Change status of all BM installed
for
bm
in
bm_list
:
bm
.
setStatus
(
'installed'
)
if
error_list
:
raise
ValueError
(
' '
.
join
(
error_list
))
installMultipleBusinessManager
=
updateInstallationState
def
compareOldStateToOFS
(
self
,
installation_process
,
old_state
):
...
...
@@ -1772,20 +1776,20 @@ class TemplateTool (BaseTool):
try
:
obj
=
portal
.
restrictedTraverse
(
path
)
obj_sha
=
hashlib
.
sha256
(
obj
.
to
XML
()).
hexdigest
()
obj_sha
=
hashlib
.
sha256
(
obj
.
as
XML
()).
hexdigest
()
# Get item at old state
old_item
=
old_state
.
getBusinessItemByPath
()
old_item
=
old_state
.
getBusinessItemByPath
(
path
)
# Check if there is an object at old state at this path
if
old_item
:
# Compare hash with ZODB
if
old_item
.
_sha
==
obj
.
_sha
:
if
old_item
.
_sha
==
obj_sha
:
# No change at ZODB on old item, so get the new item
new_item
=
installation_process
.
getBusinessItemByPath
(
path
)
# Compare new item hash with ZODB
if
new_item
.
_sha
==
obj
.
_sha
:
if
new_item
.
_sha
==
obj_sha
:
# If same hash, do nothing
continue
...
...
@@ -1798,28 +1802,26 @@ class TemplateTool (BaseTool):
new_item
=
installation_process
.
getBusinessItemByPath
(
path
)
# Compare new item hash with ZODB
if
new_item
.
_sha
==
obj
.
_sha
:
if
new_item
.
_sha
==
obj_sha
:
# If same hash, do nothing
continue
else
:
# Raise error
error_list
.
append
(
'Trying to remove changes at ZODB at %s'
%
path
)
raise
ValueError
(
'Trying to remove changes at ZODB at %s'
%
path
)
else
:
# Object created at ZODB by the user
# Compare with the new_item
new_item
=
installation_process
.
getBusinessItemByPath
(
path
)
if
new_item
.
_sha
==
obj
.
_sha
:
if
new_item
.
_sha
==
obj_sha
:
# If same hash, do nothing
continue
else
:
# Raise error
error_list
.
append
(
'Trying to remove changes at ZODB at %s'
%
path
)
raise
ValueError
(
'Trying to remove changes at ZODB at %s'
%
path
)
except
Exception
:
# Get item at old state
...
...
@@ -1834,13 +1836,14 @@ class TemplateTool (BaseTool):
if
new_item
.
_sign
==
1
:
error_list
.
append
(
'Object at %s removed by user'
%
path
)
raise
ValueError
(
'Object at %s removed by user'
%
path
)
else
:
# If there is no item at old state, install the new_item
new_item
=
installation_process
.
getBusinessItemByPath
(
path
)
new_item
.
install
(
installation_process
)
return
error_list
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'createNewInstallationState'
)
def
createNewInstallationState
(
self
,
bm_list
,
old_installation_state
):
...
...
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