Commit 6e2f60fd authored by Ayush Tiwari's avatar Ayush Tiwari

DiffTool: Cleanup DiffTool and add extra support for removing useless...

DiffTool: Cleanup DiffTool and add extra support for removing useless properties from ERP5 object dicts
parent 0710d08c
......@@ -232,11 +232,14 @@ class PortalPatch:
"""
if isinstance(obj, dict):
obj_dict = obj.copy()
export = False
# Try to get the classname and module name from the dict
class_name = obj.get('portal_type', '')
module_name = obj.get('__module__', '')
else:
obj._p_activate()
klass = obj.__class__
classname = klass.__name__
class_name = klass.__name__
module_name = klass.__module__
obj_dict = obj.showDict().copy()
attribute_set = {'_dav_writelocks', '_filepath', '_owner', '_related_index',
......@@ -264,13 +267,13 @@ class PortalPatch:
attribute_set.update(('func_code', 'func_defaults', '_code',
'_lazy_compilation', 'Python_magic', 'errors',
'warnings', '_proxy_roles'))
elif classname in ('File', 'Image'):
elif class_name in ('File', 'Image'):
attribute_set.update(('_EtagSupport__etag', 'size'))
elif classname == 'SQL' and klass.__module__ == 'Products.ZSQLMethods.SQL':
elif class_name == 'SQL' and module_name == 'Products.ZSQLMethods.SQL':
attribute_set.update(('_arg', 'template'))
elif interfaces.IIdGenerator.providedBy(obj):
attribute_set.update(('last_max_id_dict', 'last_id_dict'))
elif classname == 'Types Tool' and klass.__module__ == 'erp5.portal_type':
elif class_name == 'Types Tool' and module_name == 'erp5.portal_type':
attribute_set.add('type_provider_list')
for attribute in list(obj_dict.keys()):
......
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