Commit 3bdde386 authored by Sebastien Robin's avatar Sebastien Robin

[erp5_core]: DiffTool, do not break projects not having yet deepdiff and unidiff installed

parent 3b5c38b3
...@@ -27,10 +27,20 @@ ...@@ -27,10 +27,20 @@
# #
############################################################################## ##############################################################################
import deepdiff
import difflib import difflib
from deepdiff import DeepDiff import warnings
from unidiff import PatchSet try:
import deepdiff
except ImportError:
deepdiff = None
warnings.warn("Please install deepdiff, it is needed by Diff Tool",
DeprecationWarning)
try:
from unidiff import PatchSet
except ImportError:
PatchSet = None
warnings.warn("Please install unidiff, it is needed by Diff Tool",
DeprecationWarning)
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
...@@ -124,7 +134,7 @@ class PortalPatch: ...@@ -124,7 +134,7 @@ class PortalPatch:
new_value_dict = self.removePropertyList(self.new_value, export=True) new_value_dict = self.removePropertyList(self.new_value, export=True)
# Get the DeepDiff in tree format. # Get the DeepDiff in tree format.
tree_diff = DeepDiff(old_value_dict, tree_diff = deepdiff.DeepDiff(old_value_dict,
new_value_dict, new_value_dict,
view='tree') view='tree')
diff_tree_list = [] diff_tree_list = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment