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
alecs_myu
erp5
Commits
057a64a7
Commit
057a64a7
authored
Mar 21, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_config: Do not convert to XML to compare objects
parent
1ba9bd01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
product/ERP5/Document/BusinessManager.py
product/ERP5/Document/BusinessManager.py
+4
-1
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+16
-2
No files found.
product/ERP5/Document/BusinessManager.py
View file @
057a64a7
...
...
@@ -38,6 +38,7 @@ import hashlib
import
fnmatch
import
re
import
threading
import
pprint
from
copy
import
deepcopy
from
collections
import
defaultdict
from
cStringIO
import
StringIO
...
...
@@ -615,7 +616,9 @@ class BusinessItem(Implicit, Persistent):
try
:
sha256
=
hashlib
.
sha256
(
self
.
_value
).
hexdigest
()
except
TypeError
:
sha256
=
hashlib
.
sha256
(
self
.
_value
.
asXML
()).
hexdigest
()
obj_dict
=
self
.
_value
.
__dict__
.
copy
()
del
obj_dict
[
'uid'
]
sha256
=
hash
(
pprint
.
pformat
(
obj_dict
))
self
.
_sha
=
sha256
def
build
(
self
,
context
,
**
kw
):
...
...
product/ERP5/Tool/TemplateTool.py
View file @
057a64a7
...
...
@@ -34,6 +34,7 @@ import os
import
shutil
import
sys
import
hashlib
import
pprint
from
Acquisition
import
Implicit
,
Explicit
from
AccessControl
import
ClassSecurityInfo
...
...
@@ -1776,7 +1777,20 @@ class TemplateTool (BaseTool):
try
:
obj
=
portal
.
restrictedTraverse
(
path
)
obj_sha
=
hashlib
.
sha256
(
obj
.
asXML
()).
hexdigest
()
# 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
))
# Get item at old state
old_item
=
old_state
.
getBusinessItemByPath
(
path
)
# Check if there is an object at old state at this path
...
...
@@ -1823,7 +1837,7 @@ class TemplateTool (BaseTool):
# Raise error
error_list
.
append
(
'Trying to remove changes at ZODB at %s'
%
path
)
except
Exception
:
except
KeyError
:
# Get item at old state
old_item
=
old_state
.
getBusinessItemByPath
(
path
)
# Check if there is an object at old state at this 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