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
amrani
erp5
Commits
69504848
Commit
69504848
authored
Aug 10, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Return change_list instead of returning error_list after comparing states
parent
5061da1f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+18
-16
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
69504848
...
@@ -2052,14 +2052,12 @@ class TemplateTool (BaseTool):
...
@@ -2052,14 +2052,12 @@ class TemplateTool (BaseTool):
installation_process
.
_setObject
(
new_id
,
aq_base
(
item
),
installation_process
.
_setObject
(
new_id
,
aq_base
(
item
),
suppress_events
=
True
)
suppress_events
=
True
)
error
_list
=
self
.
compareOldStateToOFS
(
installation_process
,
old_installation_state
)
change
_list
=
self
.
compareOldStateToOFS
(
installation_process
,
old_installation_state
)
# Change status of all BM installed
if
change_list
:
for
bm
in
bm_list
:
change_list
=
[(
l
[
0
].
item_path
,
l
[
1
])
for
l
in
change_list
]
bm
.
setStatus
(
'installed'
)
if
error_list
:
return
change_list
raise
ValueError
(
' '
.
join
(
error_list
))
installMultipleBusinessManager
=
updateInstallationState
installMultipleBusinessManager
=
updateInstallationState
...
@@ -2160,7 +2158,9 @@ class TemplateTool (BaseTool):
...
@@ -2160,7 +2158,9 @@ class TemplateTool (BaseTool):
to_update_path_list
=
installation_process
.
getPathList
()
to_update_path_list
=
installation_process
.
getPathList
()
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
error_list
=
[]
# List to store what changes will be done to which path. Here we compare
# with all the states (old version, new version and state of object at ZODB)
change_list
=
[]
to_update_path_list
=
self
.
sortPathList
(
to_update_path_list
)
to_update_path_list
=
self
.
sortPathList
(
to_update_path_list
)
...
@@ -2212,14 +2212,14 @@ class TemplateTool (BaseTool):
...
@@ -2212,14 +2212,14 @@ class TemplateTool (BaseTool):
if
new_item
.
getProperty
(
'item_sha'
)
==
obj_sha
:
if
new_item
.
getProperty
(
'item_sha'
)
==
obj_sha
:
if
int
(
new_item
.
getProperty
(
'item_sign'
))
==
-
1
:
if
int
(
new_item
.
getProperty
(
'item_sign'
))
==
-
1
:
# If the sign is negative, remove the value from the path
# If the sign is negative, remove the value from the path
new_item
.
install
(
installation_process
)
change_list
.
append
((
new_item
,
'Removing'
)
)
else
:
else
:
# If same hash, and +1 sign, do nothing
# If same hash, and +1 sign, do nothing
continue
continue
else
:
else
:
# Install the new_item
# Install the new_item
new_item
.
install
(
installation_process
)
change_list
.
append
((
new_item
,
'Adding'
)
)
else
:
else
:
# Change at ZODB, so get the new item
# Change at ZODB, so get the new item
...
@@ -2231,8 +2231,8 @@ class TemplateTool (BaseTool):
...
@@ -2231,8 +2231,8 @@ class TemplateTool (BaseTool):
continue
continue
else
:
else
:
#
Raise error
#
Trying to update change at ZODB
error_list
.
append
(
'Trying to remove changes at ZODB at %s'
%
path
)
change_list
.
append
((
new_item
,
'Updating'
)
)
else
:
else
:
# Object created at ZODB by the user
# Object created at ZODB by the user
...
@@ -2244,8 +2244,8 @@ class TemplateTool (BaseTool):
...
@@ -2244,8 +2244,8 @@ class TemplateTool (BaseTool):
continue
continue
else
:
else
:
#
Raise error
#
Trying to update change at ZODB
error_list
.
append
(
'Trying to remove changes at ZODB at %s'
%
path
)
change_list
.
append
((
new_item
,
'Updating'
)
)
except
(
AttributeError
,
KeyError
)
as
e
:
except
(
AttributeError
,
KeyError
)
as
e
:
# Get item at old state
# Get item at old state
...
@@ -2259,7 +2259,8 @@ class TemplateTool (BaseTool):
...
@@ -2259,7 +2259,8 @@ class TemplateTool (BaseTool):
# Check sign of new_item
# Check sign of new_item
if
int
(
new_item
.
getProperty
(
'item_sign'
))
==
1
:
if
int
(
new_item
.
getProperty
(
'item_sign'
))
==
1
:
error_list
.
append
(
'Object at %s removed by user'
%
path
)
# Object at ZODB has been removed by the user
change_item
.
append
((
new_item
,
'Adding'
))
else
:
else
:
# If there is no item at old state, install the new_item
# If there is no item at old state, install the new_item
...
@@ -2272,9 +2273,10 @@ class TemplateTool (BaseTool):
...
@@ -2272,9 +2273,10 @@ class TemplateTool (BaseTool):
value
=
new_item
.
objectValues
()[
0
]
value
=
new_item
.
objectValues
()[
0
]
except
IndexError
:
except
IndexError
:
continue
continue
new_item
.
install
(
installation_process
)
# Installing a new item
change_list
.
append
((
new_item
,
'Adding'
))
return
error
_list
return
change
_list
def
getInstalledBusinessManagerList
(
self
):
def
getInstalledBusinessManagerList
(
self
):
bm_list
=
self
.
objectValues
(
portal_type
=
'Business Manager'
)
bm_list
=
self
.
objectValues
(
portal_type
=
'Business Manager'
)
...
...
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