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
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
Noah Brackenbury
erp5
Commits
242fac2e
Commit
242fac2e
authored
Mar 24, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Calculate hash before comparing installation states and ZODB
parent
6dc7d1d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+0
-1
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+26
-13
No files found.
product/ERP5/Document/BusinessManager.py
View file @
242fac2e
...
...
@@ -752,7 +752,6 @@ class BusinessItem(Implicit, Persistent):
if
self
.
_sign
==
1
:
# install object
obj
=
self
.
_value
obj
=
obj
.
_getCopy
(
container
)
container
.
_setObject
(
object_id
,
obj
)
obj
=
container
.
_getOb
(
object_id
)
obj
.
isIndexable
=
ConstantGetter
(
'isIndexable'
,
value
=
False
)
...
...
product/ERP5/Tool/TemplateTool.py
View file @
242fac2e
...
...
@@ -1739,6 +1739,10 @@ class TemplateTool (BaseTool):
old_item
.
_sign
=
-
1
to_install_path_item_list
.
append
(
old_item
)
# Update hashes of item in old state before installation
for
item
in
old_installation_state
.
_path_item_list
:
item
.
_sha
=
self
.
calculateComparableHash
(
item
.
_value
)
# Path Item List for installation_process should be the difference between
# old and new installation state
for
item
in
new_installation_state
.
_path_item_list
:
...
...
@@ -1765,6 +1769,27 @@ class TemplateTool (BaseTool):
installMultipleBusinessManager
=
updateInstallationState
def
calculateComparableHash
(
self
,
object
):
"""
Remove some attributes before comparing hashses
and return hash of the comparable object dict
Use shallow copy of the dict of the object at ZODB after removing
attributes which changes at small updation, like workflow_history,
uid, volatile attributes(which starts with _v)
"""
obj_dict
=
object
.
__dict__
.
copy
()
removable_attributes
=
[
attr
for
attr
in
obj_dict
.
keys
()
if
attr
.
startswith
(
'_v'
)]
removable_attributes
.
append
(
'uid'
)
for
attr
in
removable_attributes
:
del
obj_dict
[
attr
]
obj_sha
=
hash
(
pprint
.
pformat
(
obj_dict
))
return
obj_sha
def
compareOldStateToOFS
(
self
,
installation_process
,
old_state
):
# Get the paths about which we are concerned about
...
...
@@ -1777,19 +1802,7 @@ class TemplateTool (BaseTool):
try
:
obj
=
portal
.
restrictedTraverse
(
path
)
# Use shallow copy of the dict of the object at ZODB after removing
# attributes which changes at small updation, like workflow_history,
# uid, volatile attributes(which starts with _v)
obj_dict
=
obj
.
__dict__
.
copy
()
removable_attributes
=
[
attr
for
attr
in
obj_dict
.
keys
()
if
attr
.
startswith
(
'_v'
)]
removable_attributes
.
append
(
'uid'
)
for
attr
in
removable_attributes
:
del
obj_dict
[
attr
]
obj_sha
=
hash
(
pprint
.
pformat
(
obj_dict
))
obj_sha
=
self
.
calculateComparableHash
(
obj
)
# Get item at old state
old_item
=
old_state
.
getBusinessItemByPath
(
path
)
...
...
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