@@ -23,6 +23,10 @@ def __eq__(self, obj):
23
23
Do a deep comparison of this object and its odml properties.
24
24
The 'id' attribute of an object is excluded, since it is
25
25
unique within a document.
26
+ SmartList attributes of 'sections' and 'properties' are
27
+ handled specially: We want to make sure that the lists'
28
+ objects are properly compared without changing the order
29
+ of the individual lists.
26
30
"""
27
31
# cannot compare totally different stuff
28
32
if not isinstance (self , obj .__class__ ):
@@ -31,6 +35,14 @@ def __eq__(self, obj):
31
35
for key in self ._format :
32
36
if key == "id" or key == "oid" :
33
37
continue
38
+ elif (isinstance (getattr (self , key ), SmartList ) and
39
+ sorted (getattr (self , key ), key = lambda x : x .name ) !=
40
+ sorted (getattr (obj , key ), key = lambda x : x .name )):
41
+ # This special case was introduced only due to the fact
42
+ # that RDF files will be loaded with randomized list
43
+ # order. With any other file format the list order
44
+ # remains unchanged.
45
+ return False
34
46
elif getattr (self , key ) != getattr (obj , key ):
35
47
return False
36
48
0 commit comments