Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
c4692bb4
Commit
c4692bb4
authored
Sep 28, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DiffTool: Add functions to get jsonpatch and deepdiff of the objects
parent
ea60ed13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
product/ERP5/Tool/DiffTool.py
product/ERP5/Tool/DiffTool.py
+15
-3
No files found.
product/ERP5/Tool/DiffTool.py
View file @
c4692bb4
...
...
@@ -27,6 +27,9 @@
#
##############################################################################
import
jsonpatch
from
deepdiff
import
DeepDiff
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
...
...
@@ -75,7 +78,9 @@ class PortalPatch:
Intialises the class from a deepdiff or
a rfc6902 patch. deepdiff is the default.
"""
pass
self
.
old_value
=
old
self
.
new_value
=
new
self
.
patch_format
=
patch_format
def
getPortalPatchOperationList
(
self
):
"""
...
...
@@ -94,13 +99,20 @@ class PortalPatch:
"""
Returns a Json patch in line with rfc6902
"""
pass
# Get the dict version of the old and new values
src
=
self
.
old_value
.
_asDict
()
dst
=
self
.
new_value
.
_asDict
()
patch
=
jsonpatch
.
make_patch
(
src
,
dst
)
return
patch
def
asDeepDiffPatch
(
self
):
"""
Returns a Json patch with deep diff extensions
"""
pass
src
=
self
.
old_value
.
_asDict
()
dst
=
self
.
new_value
.
_asDict
()
ddiff
=
DeepDiff
(
src
,
dst
,
ignore_order
=
True
,
verbose_level
=
0
)
return
ddiff
def
asStrippedHTML
(
self
):
"""
...
...
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